forked from libgit2/libgit2sharp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDisposableTuple.cs
More file actions
33 lines (27 loc) · 768 Bytes
/
DisposableTuple.cs
File metadata and controls
33 lines (27 loc) · 768 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
using System;
using LibGit2Sharp.Core.Handles;
namespace LibGit2Sharp.Core
{
internal class DisposableTuple<T1, T2> : IDisposable
where T1 : IDisposable where T2 : IDisposable
{
private Tuple<T1, T2> _tuple;
public DisposableTuple(T1 item1, T2 item2)
{
_tuple = new Tuple<T1, T2>(item1, item2);
}
public T1 Item1 { get { return _tuple.Item1; } }
public T2 Item2 { get { return _tuple.Item2; } }
public void Dispose()
{
if (_tuple == null)
{
return;
}
_tuple.Item1.SafeDispose();
_tuple.Item2.SafeDispose();
_tuple = null;
GC.SuppressFinalize(this);
}
}
}