using System; public sealed class Tuple { public Tuple(T1 item1, T2 item2) { this.item1 = item1; this.item2 = item2; } public T1 Item1 { get { return this.item1; } } public T2 Item2 { get { return this.item2; } } public override string ToString() { return string.Format("Tuple({0}, {1})", this.Item1, this.Item2); } public override int GetHashCode() { int num = 17; int num2 = num * 23; int num3; if (this.item1 == null) { num3 = 0; } else { T1 t = this.item1; num3 = t.GetHashCode(); } num = num2 + num3; int num4 = num * 23; int num5; if (this.item2 == null) { num5 = 0; } else { T2 t2 = this.item2; num5 = t2.GetHashCode(); } return num4 + num5; } public override bool Equals(object o) { if (!(o is Tuple)) { return false; } Tuple b = (Tuple)o; return this == b; } public bool Equals(Tuple other) { return this == other; } public static bool operator ==(Tuple a, Tuple b) { if (object.ReferenceEquals(a, null)) { return object.ReferenceEquals(b, null); } if (a.item1 == null && b.item1 != null) { return false; } if (a.item2 == null && b.item2 != null) { return false; } T1 t = a.item1; bool result; if (t.Equals(b.item1)) { T2 t2 = a.item2; result = t2.Equals(b.item2); } else { result = false; } return result; } public static bool operator !=(Tuple a, Tuple b) { return !(a == b); } public void Unpack(Action unpackerDelegate) { unpackerDelegate(this.Item1, this.Item2); } private readonly T1 item1; private readonly T2 item2; }