1
// -----------------------------------------------------------------------
2 // Copyright (c) Microsoft Corporation. All rights reserved.
3 // -----------------------------------------------------------------------
9 // This is a very minimalistic implementation of Tuple'2 that allows us
10 // to compile and work on versions of .Net eariler then 4.0.
11 public struct Tuple
<TItem1
, TItem2
>
13 public Tuple(TItem1 item1
, TItem2 item2
)
15 this = new Tuple
<TItem1
, TItem2
>();
20 public TItem1 Item1 { get; private set; }
21 public TItem2 Item2 { get; private set; }
23 public override bool Equals(object obj
)
25 if (obj
is Tuple
<TItem1
, TItem2
>)
27 Tuple
<TItem1
, TItem2
> that
= (Tuple
<TItem1
, TItem2
>)obj
;
28 return object.Equals(this.Item1
, that
.Item1
) && object.Equals(this.Item2
, that
.Item2
);
36 public override int GetHashCode()
38 return ((this.Item1
!= null) ? this.Item1
.GetHashCode() : 0) ^
((this.Item2
!= null) ? this.Item2
.GetHashCode() : 0);
41 public static bool operator ==(Tuple
<TItem1
, TItem2
> left
, Tuple
<TItem1
, TItem2
> right
)
43 return left
.Equals(right
);
46 public static bool operator !=(Tuple
<TItem1
, TItem2
> left
, Tuple
<TItem1
, TItem2
> right
)
48 return !left
.Equals(right
);