Advertisement
dittodhole

Decompilation System.Tuple

Dec 6th, 2012
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 4.28 KB | None | 0 0
  1. // Generated by Reflector from C:\Windows\Microsoft.Net\assembly\GAC_64\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll
  2. namespace System
  3. {
  4.     using System.Collections;
  5.     using System.Collections.Generic;
  6.     using System.Runtime;
  7.     using System.Text;
  8.    
  9.     [Serializable, __DynamicallyInvokable]
  10.     public class Tuple<T1, T2> : IStructuralEquatable, IStructuralComparable, IComparable, ITuple
  11.     {
  12.         private readonly T1 m_Item1;
  13.         private readonly T2 m_Item2;
  14.        
  15.         [__DynamicallyInvokable, TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]
  16.         public Tuple(T1 item1, T2 item2)
  17.         {
  18.             this.m_Item1 = item1;
  19.             this.m_Item2 = item2;
  20.         }
  21.        
  22.         [__DynamicallyInvokable]
  23.         public override bool Equals(object obj)
  24.         {
  25.             return ((IStructuralEquatable) this).Equals(obj, EqualityComparer<object>.Default);
  26.         }
  27.        
  28.         [__DynamicallyInvokable]
  29.         public override int GetHashCode()
  30.         {
  31.             return ((IStructuralEquatable) this).GetHashCode(EqualityComparer<object>.Default);
  32.         }
  33.        
  34.         [__DynamicallyInvokable]
  35.         int IStructuralComparable.CompareTo(object other, IComparer comparer)
  36.         {
  37.             if (other == null)
  38.             {
  39.                 return 1;
  40.             }
  41.             Tuple<T1, T2> tuple = other as Tuple<T1, T2>;
  42.             if (tuple == null)
  43.             {
  44.                 throw new ArgumentException(Environment.GetResourceString("ArgumentException_TupleIncorrectType", new object[] { base.GetType().ToString() }), "other");
  45.             }
  46.             int num = 0;
  47.             num = comparer.Compare(this.m_Item1, tuple.m_Item1);
  48.             if (num != 0)
  49.             {
  50.                 return num;
  51.             }
  52.             return comparer.Compare(this.m_Item2, tuple.m_Item2);
  53.         }
  54.        
  55.         [__DynamicallyInvokable]
  56.         bool IStructuralEquatable.Equals(object other, IEqualityComparer comparer)
  57.         {
  58.             if (other == null)
  59.             {
  60.                 return false;
  61.             }
  62.             Tuple<T1, T2> tuple = other as Tuple<T1, T2>;
  63.             if (tuple == null)
  64.             {
  65.                 return false;
  66.             }
  67.             return (comparer.Equals(this.m_Item1, tuple.m_Item1) && comparer.Equals(this.m_Item2, tuple.m_Item2));
  68.         }
  69.        
  70.         [__DynamicallyInvokable]
  71.         int IStructuralEquatable.GetHashCode(IEqualityComparer comparer)
  72.         {
  73.             return Tuple.CombineHashCodes(comparer.GetHashCode(this.m_Item1), comparer.GetHashCode(this.m_Item2));
  74.         }
  75.        
  76.         [__DynamicallyInvokable]
  77.         int IComparable.CompareTo(object obj)
  78.         {
  79.             return ((IStructuralComparable) this).CompareTo(obj, Comparer<object>.Default);
  80.         }
  81.        
  82.         int ITuple.GetHashCode(IEqualityComparer comparer)
  83.         {
  84.             return ((IStructuralEquatable) this).GetHashCode(comparer);
  85.         }
  86.        
  87.         string ITuple.ToString(StringBuilder sb)
  88.         {
  89.             sb.Append(this.m_Item1);
  90.             sb.Append(", ");
  91.             sb.Append(this.m_Item2);
  92.             sb.Append(")");
  93.             return sb.ToString();
  94.         }
  95.        
  96.         [__DynamicallyInvokable]
  97.         public override string ToString()
  98.         {
  99.             StringBuilder sb = new StringBuilder();
  100.             sb.Append("(");
  101.             return ((ITuple) this).ToString(sb);
  102.         }
  103.        
  104.         [__DynamicallyInvokable]
  105.         public T1 Item1
  106.         {
  107.             [__DynamicallyInvokable, TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]
  108.             get
  109.             {
  110.                 return this.m_Item1;
  111.             }
  112.         }
  113.        
  114.         [__DynamicallyInvokable]
  115.         public T2 Item2
  116.         {
  117.             [__DynamicallyInvokable, TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]
  118.             get
  119.             {
  120.                 return this.m_Item2;
  121.             }
  122.         }
  123.        
  124.         int ITuple.Size
  125.         {
  126.             get
  127.             {
  128.                 return 2;
  129.             }
  130.         }
  131.     }
  132. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement