using System; using System.Collections; using System.Collections.Generic; using System.Text; namespace System { internal interface ITuple { int Size { get; } string ToString(StringBuilder sb); int GetHashCode(IEqualityComparer comparer); } /// Defines methods to support the comparison of objects for structural equality. [__DynamicallyInvokable] public interface IStructuralEquatable { /// Determines whether an object is structurally equal to the current instance. /// true if the two objects are equal; otherwise, false. /// The object to compare with the current instance. /// An object that determines whether the current instance and are equal. [__DynamicallyInvokable] bool Equals(object other, IEqualityComparer comparer); /// Returns a hash code for the current instance. /// The hash code for the current instance. /// An object that computes the hash code of the current object. [__DynamicallyInvokable] int GetHashCode(IEqualityComparer comparer); } /// Supports the structural comparison of collection objects. [__DynamicallyInvokable] public interface IStructuralComparable { /// Determines whether the current collection object precedes, occurs in the same position as, or follows another object in the sort order. /// An integer that indicates the relationship of the current collection object to , as shown in the following table.Return valueDescription-1The current instance precedes .0The current instance and are equal.1The current instance follows . /// The object to compare with the current instance. /// An object that compares members of the current collection object with the corresponding members of . /// This instance and are not the same type. [__DynamicallyInvokable] int CompareTo(object other, IComparer comparer); } /// Provides static methods for creating tuple objects. [__DynamicallyInvokable] public static class Tuple { /// Creates a new 1-tuple, or singleton. /// A tuple whose value is (). /// The value of the only component of the tuple. /// The type of the only component of the tuple. [__DynamicallyInvokable] public static Tuple Create(T1 item1) { return new Tuple(item1); } /// Creates a new 2-tuple, or pair. /// A 2-tuple whose value is (, ). /// The value of the first component of the tuple. /// The value of the second component of the tuple. /// The type of the first component of the tuple. /// The type of the second component of the tuple. [__DynamicallyInvokable] public static Tuple Create(T1 item1, T2 item2) { return new Tuple(item1, item2); } /// Creates a new 3-tuple, or triple. /// A 3-tuple whose value is (, , ). /// The value of the first component of the tuple. /// The value of the second component of the tuple. /// The value of the third component of the tuple. /// The type of the first component of the tuple. /// The type of the second component of the tuple. /// The type of the third component of the tuple. [__DynamicallyInvokable] public static Tuple Create(T1 item1, T2 item2, T3 item3) { return new Tuple(item1, item2, item3); } /// Creates a new 4-tuple, or quadruple. /// A 4-tuple whose value is (, , , ). /// The value of the first component of the tuple. /// The value of the second component of the tuple. /// The value of the third component of the tuple. /// The value of the fourth component of the tuple. /// The type of the first component of the tuple. /// The type of the second component of the tuple. /// The type of the third component of the tuple. /// The type of the fourth component of the tuple. [__DynamicallyInvokable] public static Tuple Create(T1 item1, T2 item2, T3 item3, T4 item4) { return new Tuple(item1, item2, item3, item4); } /// Creates a new 5-tuple, or quintuple. /// A 5-tuple whose value is (, , , , ). /// The value of the first component of the tuple. /// The value of the second component of the tuple. /// The value of the third component of the tuple. /// The value of the fourth component of the tuple. /// The value of the fifth component of the tuple. /// The type of the first component of the tuple. /// The type of the second component of the tuple. /// The type of the third component of the tuple. /// The type of the fourth component of the tuple. /// The type of the fifth component of the tuple. [__DynamicallyInvokable] public static Tuple Create(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5) { return new Tuple(item1, item2, item3, item4, item5); } /// Creates a new 6-tuple, or sextuple. /// A 6-tuple whose value is (, , , , , ). /// The value of the first component of the tuple. /// The value of the second component of the tuple. /// The value of the third component of the tuple. /// The value of the fourth component of the tuple. /// The value of the fifth component of the tuple. /// The value of the sixth component of the tuple. /// The type of the first component of the tuple. /// The type of the second component of the tuple. /// The type of the third component of the tuple. /// The type of the fourth component of the tuple. /// The type of the fifth component of the tuple. /// The type of the sixth component of the tuple. [__DynamicallyInvokable] public static Tuple Create(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6) { return new Tuple(item1, item2, item3, item4, item5, item6); } /// Creates a new 7-tuple, or septuple. /// A 7-tuple whose value is (, , , , , , ). /// The value of the first component of the tuple. /// The value of the second component of the tuple. /// The value of the third component of the tuple. /// The value of the fourth component of the tuple. /// The value of the fifth component of the tuple. /// The value of the sixth component of the tuple. /// The value of the seventh component of the tuple. /// The type of the first component of the tuple. /// The type of the second component of the tuple. /// The type of the third component of the tuple. /// The type of the fourth component of the tuple. /// The type of the fifth component of the tuple. /// The type of the sixth component of the tuple. /// The type of the seventh component of the tuple. [__DynamicallyInvokable] public static Tuple Create(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6, T7 item7) { return new Tuple(item1, item2, item3, item4, item5, item6, item7); } /// Creates a new 8-tuple, or octuple. /// An 8-tuple (octuple) whose value is (, , , , , , , ). /// The value of the first component of the tuple. /// The value of the second component of the tuple. /// The value of the third component of the tuple. /// The value of the fourth component of the tuple. /// The value of the fifth component of the tuple. /// The value of the sixth component of the tuple. /// The value of the seventh component of the tuple. /// The value of the eighth component of the tuple. /// The type of the first component of the tuple. /// The type of the second component of the tuple. /// The type of the third component of the tuple. /// The type of the fourth component of the tuple. /// The type of the fifth component of the tuple. /// The type of the sixth component of the tuple. /// The type of the seventh component of the tuple. /// The type of the eighth component of the tuple. [__DynamicallyInvokable] public static Tuple> Create(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6, T7 item7, T8 item8) { return new Tuple>(item1, item2, item3, item4, item5, item6, item7, new Tuple(item8)); } internal static int CombineHashCodes(int h1, int h2) { return (h1 << 5) + h1 ^ h2; } internal static int CombineHashCodes(int h1, int h2, int h3) { return Tuple.CombineHashCodes(Tuple.CombineHashCodes(h1, h2), h3); } internal static int CombineHashCodes(int h1, int h2, int h3, int h4) { return Tuple.CombineHashCodes(Tuple.CombineHashCodes(h1, h2), Tuple.CombineHashCodes(h3, h4)); } internal static int CombineHashCodes(int h1, int h2, int h3, int h4, int h5) { return Tuple.CombineHashCodes(Tuple.CombineHashCodes(h1, h2, h3, h4), h5); } internal static int CombineHashCodes(int h1, int h2, int h3, int h4, int h5, int h6) { return Tuple.CombineHashCodes(Tuple.CombineHashCodes(h1, h2, h3, h4), Tuple.CombineHashCodes(h5, h6)); } internal static int CombineHashCodes(int h1, int h2, int h3, int h4, int h5, int h6, int h7) { return Tuple.CombineHashCodes(Tuple.CombineHashCodes(h1, h2, h3, h4), Tuple.CombineHashCodes(h5, h6, h7)); } internal static int CombineHashCodes(int h1, int h2, int h3, int h4, int h5, int h6, int h7, int h8) { return Tuple.CombineHashCodes(Tuple.CombineHashCodes(h1, h2, h3, h4), Tuple.CombineHashCodes(h5, h6, h7, h8)); } } /// Represents a 1-tuple, or singleton. /// The type of the tuple's only component. /// 1 [__DynamicallyInvokable] [Serializable] public class Tuple : IStructuralEquatable, IStructuralComparable, IComparable, ITuple { private readonly T1 m_Item1; /// Gets the value of the object's single component. /// The value of the current object's single component. [__DynamicallyInvokable] public T1 Item1 { [__DynamicallyInvokable] get { return this.m_Item1; } } int ITuple.Size { get { return 1; } } /// Initializes a new instance of the class. /// The value of the tuple's only component. [__DynamicallyInvokable] public Tuple(T1 item1) { this.m_Item1 = item1; } /// Returns a value that indicates whether the current object is equal to a specified object. /// true if the current instance is equal to the specified object; otherwise, false. /// The object to compare with this instance. [__DynamicallyInvokable] public override bool Equals(object obj) { return ((IStructuralEquatable)this).Equals(obj, EqualityComparer.Default); } /// Returns a value that indicates whether the current object is equal to a specified object based on a specified comparison method. /// true if the current instance is equal to the specified object; otherwise, false. /// The object to compare with this instance. /// An object that defines the method to use to evaluate whether the two objects are equal. [__DynamicallyInvokable] bool IStructuralEquatable.Equals(object other, IEqualityComparer comparer) { if (other == null) { return false; } Tuple tuple = other as Tuple; return tuple != null && comparer.Equals(this.m_Item1, tuple.m_Item1); } /// Compares the current object to a specified object, and returns an integer that indicates whether the current object is before, after, or in the same position as the specified object in the sort order. /// A signed integer that indicates the relative position of this instance and in the sort order, as shown in the following table.ValueDescriptionA negative integerThis instance precedes .ZeroThis instance and have the same position in the sort order.A positive integerThis instance follows . /// An object to compare with the current instance. /// /// is not a object. [__DynamicallyInvokable] int IComparable.CompareTo(object obj) { return ((IStructuralComparable)this).CompareTo(obj, Comparer.Default); } /// Compares the current object to a specified object by using a specified comparer, and returns an integer that indicates whether the current object is before, after, or in the same position as the specified object in the sort order. /// A signed integer that indicates the relative position of this instance and in the sort order, as shown in the following table.ValueDescriptionA negative integerThis instance precedes .ZeroThis instance and have the same position in the sort order.A positive integerThis instance follows . /// An object to compare with the current instance. /// An object that provides custom rules for comparison. /// /// is not a object. [__DynamicallyInvokable] int IStructuralComparable.CompareTo(object other, IComparer comparer) { if (other == null) { return 1; } Tuple tuple = other as Tuple; if (tuple == null) { throw new ArgumentException("ArgumentException_TupleIncorrectType"); } return comparer.Compare(this.m_Item1, tuple.m_Item1); } /// Returns the hash code for the current object. /// A 32-bit signed integer hash code. [__DynamicallyInvokable] public override int GetHashCode() { return ((IStructuralEquatable)this).GetHashCode(EqualityComparer.Default); } /// Calculates the hash code for the current object by using a specified computation method. /// A 32-bit signed integer hash code. /// An object whose method calculates the hash code of the current object. [__DynamicallyInvokable] int IStructuralEquatable.GetHashCode(IEqualityComparer comparer) { return comparer.GetHashCode(this.m_Item1); } int ITuple.GetHashCode(IEqualityComparer comparer) { return ((IStructuralEquatable)this).GetHashCode(comparer); } /// Returns a string that represents the value of this instance. /// The string representation of this object. [__DynamicallyInvokable] public override string ToString() { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append("("); return ((ITuple)this).ToString(stringBuilder); } string ITuple.ToString(StringBuilder sb) { sb.Append(this.m_Item1); sb.Append(")"); return sb.ToString(); } } /// Represents a 2-tuple, or pair. /// The type of the tuple's first component. /// The type of the tuple's second component. /// 2 [__DynamicallyInvokable] [Serializable] public class Tuple : IStructuralEquatable, IStructuralComparable, IComparable, ITuple { private readonly T1 m_Item1; private readonly T2 m_Item2; /// Gets the value of the current object's first component. /// The value of the current object's first component. [__DynamicallyInvokable] public T1 Item1 { [__DynamicallyInvokable] get { return this.m_Item1; } } /// Gets the value of the current object's second component. /// The value of the current object's second component. [__DynamicallyInvokable] public T2 Item2 { [__DynamicallyInvokable] get { return this.m_Item2; } } int ITuple.Size { get { return 2; } } /// Initializes a new instance of the class. /// The value of the tuple's first component. /// The value of the tuple's second component. [__DynamicallyInvokable] public Tuple(T1 item1, T2 item2) { this.m_Item1 = item1; this.m_Item2 = item2; } /// Returns a value that indicates whether the current object is equal to a specified object. /// true if the current instance is equal to the specified object; otherwise, false. /// The object to compare with this instance. [__DynamicallyInvokable] public override bool Equals(object obj) { return ((IStructuralEquatable)this).Equals(obj, EqualityComparer.Default); } /// Returns a value that indicates whether the current object is equal to a specified object based on a specified comparison method. /// true if the current instance is equal to the specified object; otherwise, false. /// The object to compare with this instance. /// An object that defines the method to use to evaluate whether the two objects are equal. [__DynamicallyInvokable] bool IStructuralEquatable.Equals(object other, IEqualityComparer comparer) { if (other == null) { return false; } Tuple tuple = other as Tuple; return tuple != null && comparer.Equals(this.m_Item1, tuple.m_Item1) && comparer.Equals(this.m_Item2, tuple.m_Item2); } /// Compares the current object to a specified object and returns an integer that indicates whether the current object is before, after, or in the same position as the specified object in the sort order. /// A signed integer that indicates the relative position of this instance and in the sort order, as shown in the following table.ValueDescriptionA negative integerThis instance precedes .ZeroThis instance and have the same position in the sort order.A positive integerThis instance follows . /// An object to compare with the current instance. /// /// is not a object. [__DynamicallyInvokable] int IComparable.CompareTo(object obj) { return ((IStructuralComparable)this).CompareTo(obj, Comparer.Default); } /// Compares the current object to a specified object by using a specified comparer, and returns an integer that indicates whether the current object is before, after, or in the same position as the specified object in the sort order. /// A signed integer that indicates the relative position of this instance and in the sort order, as shown in the following table.ValueDescriptionA negative integerThis instance precedes .ZeroThis instance and have the same position in the sort order.A positive integerThis instance follows . /// An object to compare with the current instance. /// An object that provides custom rules for comparison. /// /// is not a object. [__DynamicallyInvokable] int IStructuralComparable.CompareTo(object other, IComparer comparer) { if (other == null) { return 1; } Tuple tuple = other as Tuple; if (tuple == null) { throw new ArgumentException("ArgumentException_TupleIncorrectType"); } int num = comparer.Compare(this.m_Item1, tuple.m_Item1); if (num != 0) { return num; } return comparer.Compare(this.m_Item2, tuple.m_Item2); } /// Returns the hash code for the current object. /// A 32-bit signed integer hash code. [__DynamicallyInvokable] public override int GetHashCode() { return ((IStructuralEquatable)this).GetHashCode(EqualityComparer.Default); } /// Calculates the hash code for the current object by using a specified computation method. /// A 32-bit signed integer hash code. /// An object whose method calculates the hash code of the current object. [__DynamicallyInvokable] int IStructuralEquatable.GetHashCode(IEqualityComparer comparer) { return Tuple.CombineHashCodes(comparer.GetHashCode(this.m_Item1), comparer.GetHashCode(this.m_Item2)); } int ITuple.GetHashCode(IEqualityComparer comparer) { return ((IStructuralEquatable)this).GetHashCode(comparer); } /// Returns a string that represents the value of this instance. /// The string representation of this object. [__DynamicallyInvokable] public override string ToString() { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append("("); return ((ITuple)this).ToString(stringBuilder); } string ITuple.ToString(StringBuilder sb) { sb.Append(this.m_Item1); sb.Append(", "); sb.Append(this.m_Item2); sb.Append(")"); return sb.ToString(); } } /// Represents a 3-tuple, or triple. /// The type of the tuple's first component. /// The type of the tuple's second component. /// The type of the tuple's third component. /// 2 [__DynamicallyInvokable] [Serializable] public class Tuple : IStructuralEquatable, IStructuralComparable, IComparable, ITuple { private readonly T1 m_Item1; private readonly T2 m_Item2; private readonly T3 m_Item3; /// Gets the value of the current object's first component. /// The value of the current object's first component. [__DynamicallyInvokable] public T1 Item1 { [__DynamicallyInvokable] get { return this.m_Item1; } } /// Gets the value of the current object's second component. /// The value of the current object's second component. [__DynamicallyInvokable] public T2 Item2 { [__DynamicallyInvokable] get { return this.m_Item2; } } /// Gets the value of the current object's third component. /// The value of the current object's third component. [__DynamicallyInvokable] public T3 Item3 { [__DynamicallyInvokable] get { return this.m_Item3; } } int ITuple.Size { get { return 3; } } /// Initializes a new instance of the class. /// The value of the tuple's first component. /// The value of the tuple's second component. /// The value of the tuple's third component. [__DynamicallyInvokable] public Tuple(T1 item1, T2 item2, T3 item3) { this.m_Item1 = item1; this.m_Item2 = item2; this.m_Item3 = item3; } /// Returns a value that indicates whether the current object is equal to a specified object. /// true if the current instance is equal to the specified object; otherwise, false. /// The object to compare with this instance. [__DynamicallyInvokable] public override bool Equals(object obj) { return ((IStructuralEquatable)this).Equals(obj, EqualityComparer.Default); } /// Returns a value that indicates whether the current object is equal to a specified object based on a specified comparison method. /// true if the current instance is equal to the specified object; otherwise, false. /// The object to compare with this instance. /// An object that defines the method to use to evaluate whether the two objects are equal. [__DynamicallyInvokable] bool IStructuralEquatable.Equals(object other, IEqualityComparer comparer) { if (other == null) { return false; } Tuple tuple = other as Tuple; return tuple != null && (comparer.Equals(this.m_Item1, tuple.m_Item1) && comparer.Equals(this.m_Item2, tuple.m_Item2)) && comparer.Equals(this.m_Item3, tuple.m_Item3); } /// Compares the current object to a specified object and returns an integer that indicates whether the current object is before, after, or in the same position as the specified object in the sort order. /// A signed integer that indicates the relative position of this instance and in the sort order, as shown in the following table.ValueDescriptionA negative integerThis instance precedes .ZeroThis instance and have the same position in the sort order.A positive integerThis instance follows . /// An object to compare with the current instance. /// /// is not a object. [__DynamicallyInvokable] int IComparable.CompareTo(object obj) { return ((IStructuralComparable)this).CompareTo(obj, Comparer.Default); } /// Compares the current object to a specified object by using a specified comparer, and returns an integer that indicates whether the current object is before, after, or in the same position as the specified object in the sort order. /// A signed integer that indicates the relative position of this instance and in the sort order, as shown in the following table.ValueDescriptionA negative integerThis instance precedes .ZeroThis instance and have the same position in the sort order.A positive integerThis instance follows . /// An object to compare with the current instance. /// An object that provides custom rules for comparison. /// /// is not a object. [__DynamicallyInvokable] int IStructuralComparable.CompareTo(object other, IComparer comparer) { if (other == null) { return 1; } Tuple tuple = other as Tuple; if (tuple == null) { throw new ArgumentException("ArgumentException_TupleIncorrectType"); } int num = comparer.Compare(this.m_Item1, tuple.m_Item1); if (num != 0) { return num; } num = comparer.Compare(this.m_Item2, tuple.m_Item2); if (num != 0) { return num; } return comparer.Compare(this.m_Item3, tuple.m_Item3); } /// Returns the hash code for the current object. /// A 32-bit signed integer hash code. [__DynamicallyInvokable] public override int GetHashCode() { return ((IStructuralEquatable)this).GetHashCode(EqualityComparer.Default); } /// Calculates the hash code for the current object by using a specified computation method. /// A 32-bit signed integer hash code. /// An object whose method calculates the hash code of the current object. [__DynamicallyInvokable] int IStructuralEquatable.GetHashCode(IEqualityComparer comparer) { return Tuple.CombineHashCodes(comparer.GetHashCode(this.m_Item1), comparer.GetHashCode(this.m_Item2), comparer.GetHashCode(this.m_Item3)); } int ITuple.GetHashCode(IEqualityComparer comparer) { return ((IStructuralEquatable)this).GetHashCode(comparer); } /// Returns a string that represents the value of this instance. /// The string representation of this object. [__DynamicallyInvokable] public override string ToString() { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append("("); return ((ITuple)this).ToString(stringBuilder); } string ITuple.ToString(StringBuilder sb) { sb.Append(this.m_Item1); sb.Append(", "); sb.Append(this.m_Item2); sb.Append(", "); sb.Append(this.m_Item3); sb.Append(")"); return sb.ToString(); } } /// Represents a 4-tuple, or quadruple. /// The type of the tuple's first component. /// The type of the tuple's second component. /// The type of the tuple's third component. /// The type of the tuple's fourth component. /// 2 [__DynamicallyInvokable] [Serializable] public class Tuple : IStructuralEquatable, IStructuralComparable, IComparable, ITuple { private readonly T1 m_Item1; private readonly T2 m_Item2; private readonly T3 m_Item3; private readonly T4 m_Item4; /// Gets the value of the current object's first component. /// The value of the current object's first component. [__DynamicallyInvokable] public T1 Item1 { [__DynamicallyInvokable] get { return this.m_Item1; } } /// Gets the value of the current object's second component. /// The value of the current object's second component. [__DynamicallyInvokable] public T2 Item2 { [__DynamicallyInvokable] get { return this.m_Item2; } } /// Gets the value of the current object's third component. /// The value of the current object's third component. [__DynamicallyInvokable] public T3 Item3 { [__DynamicallyInvokable] get { return this.m_Item3; } } /// Gets the value of the current object's fourth component. /// The value of the current object's fourth component. [__DynamicallyInvokable] public T4 Item4 { [__DynamicallyInvokable] get { return this.m_Item4; } } int ITuple.Size { get { return 4; } } /// Initializes a new instance of the class. /// The value of the tuple's first component. /// The value of the tuple's second component. /// The value of the tuple's third component. /// The value of the tuple's fourth component [__DynamicallyInvokable] public Tuple(T1 item1, T2 item2, T3 item3, T4 item4) { this.m_Item1 = item1; this.m_Item2 = item2; this.m_Item3 = item3; this.m_Item4 = item4; } /// Returns a value that indicates whether the current object is equal to a specified object. /// true if the current instance is equal to the specified object; otherwise, false. /// The object to compare with this instance. [__DynamicallyInvokable] public override bool Equals(object obj) { return ((IStructuralEquatable)this).Equals(obj, EqualityComparer.Default); } /// Returns a value that indicates whether the current object is equal to a specified object based on a specified comparison method. /// true if the current instance is equal to the specified object; otherwise, false. /// The object to compare with this instance. /// An object that defines the method to use to evaluate whether the two objects are equal. [__DynamicallyInvokable] bool IStructuralEquatable.Equals(object other, IEqualityComparer comparer) { if (other == null) { return false; } Tuple tuple = other as Tuple; return tuple != null && (comparer.Equals(this.m_Item1, tuple.m_Item1) && comparer.Equals(this.m_Item2, tuple.m_Item2) && comparer.Equals(this.m_Item3, tuple.m_Item3)) && comparer.Equals(this.m_Item4, tuple.m_Item4); } /// Compares the current object to a specified object and returns an integer that indicates whether the current object is before, after, or in the same position as the specified object in the sort order. /// A signed integer that indicates the relative position of this instance and in the sort order, as shown in the following table.ValueDescriptionA negative integerThis instance precedes .ZeroThis instance and have the same position in the sort order.A positive integerThis instance follows . /// An object to compare with the current instance. /// /// is not a object. [__DynamicallyInvokable] int IComparable.CompareTo(object obj) { return ((IStructuralComparable)this).CompareTo(obj, Comparer.Default); } /// Compares the current object to a specified object by using a specified comparer and returns an integer that indicates whether the current object is before, after, or in the same position as the specified object in the sort order. /// A signed integer that indicates the relative position of this instance and in the sort order, as shown in the following table.ValueDescriptionA negative integerThis instance precedes .ZeroThis instance and have the same position in the sort order.A positive integerThis instance follows . /// An object to compare with the current instance. /// An object that provides custom rules for comparison. /// /// is not a object. [__DynamicallyInvokable] int IStructuralComparable.CompareTo(object other, IComparer comparer) { if (other == null) { return 1; } Tuple tuple = other as Tuple; if (tuple == null) { throw new ArgumentException("ArgumentException_TupleIncorrectType"); } int num = comparer.Compare(this.m_Item1, tuple.m_Item1); if (num != 0) { return num; } num = comparer.Compare(this.m_Item2, tuple.m_Item2); if (num != 0) { return num; } num = comparer.Compare(this.m_Item3, tuple.m_Item3); if (num != 0) { return num; } return comparer.Compare(this.m_Item4, tuple.m_Item4); } /// Returns the hash code for the current object. /// A 32-bit signed integer hash code. [__DynamicallyInvokable] public override int GetHashCode() { return ((IStructuralEquatable)this).GetHashCode(EqualityComparer.Default); } /// Calculates the hash code for the current object by using a specified computation method. /// A 32-bit signed integer hash code. /// An object whose method calculates the hash code of the current object. [__DynamicallyInvokable] int IStructuralEquatable.GetHashCode(IEqualityComparer comparer) { return Tuple.CombineHashCodes(comparer.GetHashCode(this.m_Item1), comparer.GetHashCode(this.m_Item2), comparer.GetHashCode(this.m_Item3), comparer.GetHashCode(this.m_Item4)); } int ITuple.GetHashCode(IEqualityComparer comparer) { return ((IStructuralEquatable)this).GetHashCode(comparer); } /// Returns a string that represents the value of this instance. /// The string representation of this object. [__DynamicallyInvokable] public override string ToString() { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append("("); return ((ITuple)this).ToString(stringBuilder); } string ITuple.ToString(StringBuilder sb) { sb.Append(this.m_Item1); sb.Append(", "); sb.Append(this.m_Item2); sb.Append(", "); sb.Append(this.m_Item3); sb.Append(", "); sb.Append(this.m_Item4); sb.Append(")"); return sb.ToString(); } } /// Represents a 5-tuple, or quintuple. /// The type of the tuple's first component. /// The type of the tuple's second component. /// The type of the tuple's third component. /// The type of the tuple's fourth component. /// The type of the tuple's fifth component. /// 2 [__DynamicallyInvokable] [Serializable] public class Tuple : IStructuralEquatable, IStructuralComparable, IComparable, ITuple { private readonly T1 m_Item1; private readonly T2 m_Item2; private readonly T3 m_Item3; private readonly T4 m_Item4; private readonly T5 m_Item5; /// Gets the value of the current object's first component. /// The value of the current object's first component. [__DynamicallyInvokable] public T1 Item1 { [__DynamicallyInvokable] get { return this.m_Item1; } } /// Gets the value of the current object's second component. /// The value of the current object's second component. [__DynamicallyInvokable] public T2 Item2 { [__DynamicallyInvokable] get { return this.m_Item2; } } /// Gets the value of the current object's third component. /// The value of the current object's third component. [__DynamicallyInvokable] public T3 Item3 { [__DynamicallyInvokable] get { return this.m_Item3; } } /// Gets the value of the current object's fourth component. /// The value of the current object's fourth component. [__DynamicallyInvokable] public T4 Item4 { [__DynamicallyInvokable] get { return this.m_Item4; } } /// Gets the value of the current object's fifth component. /// The value of the current object's fifth component. [__DynamicallyInvokable] public T5 Item5 { [__DynamicallyInvokable] get { return this.m_Item5; } } int ITuple.Size { get { return 5; } } /// Initializes a new instance of the class. /// The value of the tuple's first component. /// The value of the tuple's second component. /// The value of the tuple's third component. /// The value of the tuple's fourth component /// The value of the tuple's fifth component. [__DynamicallyInvokable] public Tuple(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5) { this.m_Item1 = item1; this.m_Item2 = item2; this.m_Item3 = item3; this.m_Item4 = item4; this.m_Item5 = item5; } /// Returns a value that indicates whether the current object is equal to a specified object. /// true if the current instance is equal to the specified object; otherwise, false. /// The object to compare with this instance. [__DynamicallyInvokable] public override bool Equals(object obj) { return ((IStructuralEquatable)this).Equals(obj, EqualityComparer.Default); } /// Returns a value that indicates whether the current object is equal to a specified object based on a specified comparison method. /// true if the current instance is equal to the specified object; otherwise, false. /// The object to compare with this instance. /// An object that defines the method to use to evaluate whether the two objects are equal. [__DynamicallyInvokable] bool IStructuralEquatable.Equals(object other, IEqualityComparer comparer) { if (other == null) { return false; } Tuple tuple = other as Tuple; return tuple != null && (comparer.Equals(this.m_Item1, tuple.m_Item1) && comparer.Equals(this.m_Item2, tuple.m_Item2) && comparer.Equals(this.m_Item3, tuple.m_Item3) && comparer.Equals(this.m_Item4, tuple.m_Item4)) && comparer.Equals(this.m_Item5, tuple.m_Item5); } /// Compares the current object to a specified object and returns an integer that indicates whether the current object is before, after, or in the same position as the specified object in the sort order. /// A signed integer that indicates the relative position of this instance and in the sort order, as shown in the following table.ValueDescriptionA negative integerThis instance precedes .ZeroThis instance and have the same position in the sort order.A positive integerThis instance follows . /// An object to compare with the current instance. /// /// is not a object. [__DynamicallyInvokable] int IComparable.CompareTo(object obj) { return ((IStructuralComparable)this).CompareTo(obj, Comparer.Default); } /// Compares the current object to a specified object by using a specified comparer and returns an integer that indicates whether the current object is before, after, or in the same position as the specified object in the sort order. /// A signed integer that indicates the relative position of this instance and in the sort order, as shown in the following table.ValueDescriptionA negative integerThis instance precedes .ZeroThis instance and have the same position in the sort order.A positive integerThis instance follows . /// An object to compare with the current instance. /// An object that provides custom rules for comparison. /// /// is not a object. [__DynamicallyInvokable] int IStructuralComparable.CompareTo(object other, IComparer comparer) { if (other == null) { return 1; } Tuple tuple = other as Tuple; if (tuple == null) { throw new ArgumentException("ArgumentException_TupleIncorrectType"); } int num = comparer.Compare(this.m_Item1, tuple.m_Item1); if (num != 0) { return num; } num = comparer.Compare(this.m_Item2, tuple.m_Item2); if (num != 0) { return num; } num = comparer.Compare(this.m_Item3, tuple.m_Item3); if (num != 0) { return num; } num = comparer.Compare(this.m_Item4, tuple.m_Item4); if (num != 0) { return num; } return comparer.Compare(this.m_Item5, tuple.m_Item5); } /// Returns the hash code for the current object. /// A 32-bit signed integer hash code. [__DynamicallyInvokable] public override int GetHashCode() { return ((IStructuralEquatable)this).GetHashCode(EqualityComparer.Default); } /// Calculates the hash code for the current object by using a specified computation method. /// A 32-bit signed integer hash code. /// An object whose method calculates the hash code of the current object. [__DynamicallyInvokable] int IStructuralEquatable.GetHashCode(IEqualityComparer comparer) { return Tuple.CombineHashCodes(comparer.GetHashCode(this.m_Item1), comparer.GetHashCode(this.m_Item2), comparer.GetHashCode(this.m_Item3), comparer.GetHashCode(this.m_Item4), comparer.GetHashCode(this.m_Item5)); } int ITuple.GetHashCode(IEqualityComparer comparer) { return ((IStructuralEquatable)this).GetHashCode(comparer); } /// Returns a string that represents the value of this instance. /// The string representation of this object. [__DynamicallyInvokable] public override string ToString() { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append("("); return ((ITuple)this).ToString(stringBuilder); } string ITuple.ToString(StringBuilder sb) { sb.Append(this.m_Item1); sb.Append(", "); sb.Append(this.m_Item2); sb.Append(", "); sb.Append(this.m_Item3); sb.Append(", "); sb.Append(this.m_Item4); sb.Append(", "); sb.Append(this.m_Item5); sb.Append(")"); return sb.ToString(); } } /// Represents a 6-tuple, or sextuple. /// The type of the tuple's first component. /// The type of the tuple's second component. /// The type of the tuple's third component. /// The type of the tuple's fourth component. /// The type of the tuple's fifth component. /// The type of the tuple's sixth component. /// 2 [__DynamicallyInvokable] [Serializable] public class Tuple : IStructuralEquatable, IStructuralComparable, IComparable, ITuple { private readonly T1 m_Item1; private readonly T2 m_Item2; private readonly T3 m_Item3; private readonly T4 m_Item4; private readonly T5 m_Item5; private readonly T6 m_Item6; /// Gets the value of the current object's first component. /// The value of the current object's first component. [__DynamicallyInvokable] public T1 Item1 { [__DynamicallyInvokable] get { return this.m_Item1; } } /// Gets the value of the current object's second component. /// The value of the current object's second component. [__DynamicallyInvokable] public T2 Item2 { [__DynamicallyInvokable] get { return this.m_Item2; } } /// Gets the value of the current object's third component. /// The value of the current object's third component. [__DynamicallyInvokable] public T3 Item3 { [__DynamicallyInvokable] get { return this.m_Item3; } } /// Gets the value of the current object's fourth component. /// The value of the current object's fourth component. [__DynamicallyInvokable] public T4 Item4 { [__DynamicallyInvokable] get { return this.m_Item4; } } /// Gets the value of the current object's fifth component. /// The value of the current object's fifth component. [__DynamicallyInvokable] public T5 Item5 { [__DynamicallyInvokable] get { return this.m_Item5; } } /// Gets the value of the current object's sixth component. /// The value of the current object's sixth component. [__DynamicallyInvokable] public T6 Item6 { [__DynamicallyInvokable] get { return this.m_Item6; } } int ITuple.Size { get { return 6; } } /// Initializes a new instance of the class. /// The value of the tuple's first component. /// The value of the tuple's second component. /// The value of the tuple's third component. /// The value of the tuple's fourth component /// The value of the tuple's fifth component. /// The value of the tuple's sixth component. [__DynamicallyInvokable] public Tuple(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6) { this.m_Item1 = item1; this.m_Item2 = item2; this.m_Item3 = item3; this.m_Item4 = item4; this.m_Item5 = item5; this.m_Item6 = item6; } /// Returns a value that indicates whether the current object is equal to a specified object. /// true if the current instance is equal to the specified object; otherwise, false. /// The object to compare with this instance. [__DynamicallyInvokable] public override bool Equals(object obj) { return ((IStructuralEquatable)this).Equals(obj, EqualityComparer.Default); } /// Returns a value that indicates whether the current object is equal to a specified object based on a specified comparison method. /// true if the current instance is equal to the specified object; otherwise, false. /// The object to compare with this instance. /// An object that defines the method to use to evaluate whether the two objects are equal. [__DynamicallyInvokable] bool IStructuralEquatable.Equals(object other, IEqualityComparer comparer) { if (other == null) { return false; } Tuple tuple = other as Tuple; return tuple != null && (comparer.Equals(this.m_Item1, tuple.m_Item1) && comparer.Equals(this.m_Item2, tuple.m_Item2) && comparer.Equals(this.m_Item3, tuple.m_Item3) && comparer.Equals(this.m_Item4, tuple.m_Item4) && comparer.Equals(this.m_Item5, tuple.m_Item5)) && comparer.Equals(this.m_Item6, tuple.m_Item6); } /// Compares the current object to a specified object and returns an integer that indicates whether the current object is before, after, or in the same position as the specified object in the sort order. /// A signed integer that indicates the relative position of this instance and in the sort order, as shown in the following table.ValueDescriptionA negative integerThis instance precedes .ZeroThis instance and have the same position in the sort order.A positive integerThis instance follows . /// An object to compare with the current instance. /// /// is not a object. [__DynamicallyInvokable] int IComparable.CompareTo(object obj) { return ((IStructuralComparable)this).CompareTo(obj, Comparer.Default); } /// Compares the current object to a specified object by using a specified comparer and returns an integer that indicates whether the current object is before, after, or in the same position as the specified object in the sort order. /// A signed integer that indicates the relative position of this instance and in the sort order, as shown in the following table.ValueDescriptionA negative integerThis instance precedes .ZeroThis instance and have the same position in the sort order.A positive integerThis instance follows . /// An object to compare with the current instance. /// An object that provides custom rules for comparison. /// /// is not a object. [__DynamicallyInvokable] int IStructuralComparable.CompareTo(object other, IComparer comparer) { if (other == null) { return 1; } Tuple tuple = other as Tuple; if (tuple == null) { throw new ArgumentException("ArgumentException_TupleIncorrectType"); } int num = comparer.Compare(this.m_Item1, tuple.m_Item1); if (num != 0) { return num; } num = comparer.Compare(this.m_Item2, tuple.m_Item2); if (num != 0) { return num; } num = comparer.Compare(this.m_Item3, tuple.m_Item3); if (num != 0) { return num; } num = comparer.Compare(this.m_Item4, tuple.m_Item4); if (num != 0) { return num; } num = comparer.Compare(this.m_Item5, tuple.m_Item5); if (num != 0) { return num; } return comparer.Compare(this.m_Item6, tuple.m_Item6); } /// Returns the hash code for the current object. /// A 32-bit signed integer hash code. [__DynamicallyInvokable] public override int GetHashCode() { return ((IStructuralEquatable)this).GetHashCode(EqualityComparer.Default); } /// Calculates the hash code for the current object by using a specified computation method. /// A 32-bit signed integer hash code. /// An object whose method calculates the hash code of the current object. [__DynamicallyInvokable] int IStructuralEquatable.GetHashCode(IEqualityComparer comparer) { return Tuple.CombineHashCodes(comparer.GetHashCode(this.m_Item1), comparer.GetHashCode(this.m_Item2), comparer.GetHashCode(this.m_Item3), comparer.GetHashCode(this.m_Item4), comparer.GetHashCode(this.m_Item5), comparer.GetHashCode(this.m_Item6)); } int ITuple.GetHashCode(IEqualityComparer comparer) { return ((IStructuralEquatable)this).GetHashCode(comparer); } /// Returns a string that represents the value of this instance. /// The string representation of this object. [__DynamicallyInvokable] public override string ToString() { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append("("); return ((ITuple)this).ToString(stringBuilder); } string ITuple.ToString(StringBuilder sb) { sb.Append(this.m_Item1); sb.Append(", "); sb.Append(this.m_Item2); sb.Append(", "); sb.Append(this.m_Item3); sb.Append(", "); sb.Append(this.m_Item4); sb.Append(", "); sb.Append(this.m_Item5); sb.Append(", "); sb.Append(this.m_Item6); sb.Append(")"); return sb.ToString(); } } /// Represents a 7-tuple, or septuple. /// The type of the tuple's first component. /// The type of the tuple's second component. /// The type of the tuple's third component. /// The type of the tuple's fourth component. /// The type of the tuple's fifth component. /// The type of the tuple's sixth component. /// The type of the tuple's seventh component. /// 2 [__DynamicallyInvokable] [Serializable] public class Tuple : IStructuralEquatable, IStructuralComparable, IComparable, ITuple { private readonly T1 m_Item1; private readonly T2 m_Item2; private readonly T3 m_Item3; private readonly T4 m_Item4; private readonly T5 m_Item5; private readonly T6 m_Item6; private readonly T7 m_Item7; /// Gets the value of the current object's first component. /// The value of the current object's first component. [__DynamicallyInvokable] public T1 Item1 { [__DynamicallyInvokable] get { return this.m_Item1; } } /// Gets the value of the current object's second component. /// The value of the current object's second component. [__DynamicallyInvokable] public T2 Item2 { [__DynamicallyInvokable] get { return this.m_Item2; } } /// Gets the value of the current object's third component. /// The value of the current object's third component. [__DynamicallyInvokable] public T3 Item3 { [__DynamicallyInvokable] get { return this.m_Item3; } } /// Gets the value of the current object's fourth component. /// The value of the current object's fourth component. [__DynamicallyInvokable] public T4 Item4 { [__DynamicallyInvokable] get { return this.m_Item4; } } /// Gets the value of the current object's fifth component. /// The value of the current object's fifth component. [__DynamicallyInvokable] public T5 Item5 { [__DynamicallyInvokable] get { return this.m_Item5; } } /// Gets the value of the current object's sixth component. /// The value of the current object's sixth component. [__DynamicallyInvokable] public T6 Item6 { [__DynamicallyInvokable] get { return this.m_Item6; } } /// Gets the value of the current object's seventh component. /// The value of the current object's seventh component. [__DynamicallyInvokable] public T7 Item7 { [__DynamicallyInvokable] get { return this.m_Item7; } } int ITuple.Size { get { return 7; } } /// Initializes a new instance of the class. /// The value of the tuple's first component. /// The value of the tuple's second component. /// The value of the tuple's third component. /// The value of the tuple's fourth component /// The value of the tuple's fifth component. /// The value of the tuple's sixth component. /// The value of the tuple's seventh component. [__DynamicallyInvokable] public Tuple(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6, T7 item7) { this.m_Item1 = item1; this.m_Item2 = item2; this.m_Item3 = item3; this.m_Item4 = item4; this.m_Item5 = item5; this.m_Item6 = item6; this.m_Item7 = item7; } /// Returns a value that indicates whether the current object is equal to a specified object. /// true if the current instance is equal to the specified object; otherwise, false. /// The object to compare with this instance. [__DynamicallyInvokable] public override bool Equals(object obj) { return ((IStructuralEquatable)this).Equals(obj, EqualityComparer.Default); } /// Returns a value that indicates whether the current object is equal to a specified object based on a specified comparison method. /// true if the current instance is equal to the specified object; otherwise, false. /// The object to compare with this instance. /// An object that defines the method to use to evaluate whether the two objects are equal. [__DynamicallyInvokable] bool IStructuralEquatable.Equals(object other, IEqualityComparer comparer) { if (other == null) { return false; } Tuple tuple = other as Tuple; return tuple != null && (comparer.Equals(this.m_Item1, tuple.m_Item1) && comparer.Equals(this.m_Item2, tuple.m_Item2) && comparer.Equals(this.m_Item3, tuple.m_Item3) && comparer.Equals(this.m_Item4, tuple.m_Item4) && comparer.Equals(this.m_Item5, tuple.m_Item5) && comparer.Equals(this.m_Item6, tuple.m_Item6)) && comparer.Equals(this.m_Item7, tuple.m_Item7); } /// Compares the current object to a specified object and returns an integer that indicates whether the current object is before, after, or in the same position as the specified object in the sort order. /// A signed integer that indicates the relative position of this instance and in the sort order, as shown in the following table.ValueDescriptionA negative integerThis instance precedes .ZeroThis instance and have the same position in the sort order.A positive integerThis instance follows . /// An object to compare with the current instance. /// /// is not a object. [__DynamicallyInvokable] int IComparable.CompareTo(object obj) { return ((IStructuralComparable)this).CompareTo(obj, Comparer.Default); } /// Compares the current object to a specified object by using a specified comparer, and returns an integer that indicates whether the current object is before, after, or in the same position as the specified object in the sort order. /// A signed integer that indicates the relative position of this instance and in the sort order, as shown in the following table.ValueDescriptionA negative integerThis instance precedes .ZeroThis instance and have the same position in the sort order.A positive integerThis instance follows . /// An object to compare with the current instance. /// An object that provides custom rules for comparison. /// /// is not a object. [__DynamicallyInvokable] int IStructuralComparable.CompareTo(object other, IComparer comparer) { if (other == null) { return 1; } Tuple tuple = other as Tuple; if (tuple == null) { throw new ArgumentException("ArgumentException_TupleIncorrectType"); } int num = comparer.Compare(this.m_Item1, tuple.m_Item1); if (num != 0) { return num; } num = comparer.Compare(this.m_Item2, tuple.m_Item2); if (num != 0) { return num; } num = comparer.Compare(this.m_Item3, tuple.m_Item3); if (num != 0) { return num; } num = comparer.Compare(this.m_Item4, tuple.m_Item4); if (num != 0) { return num; } num = comparer.Compare(this.m_Item5, tuple.m_Item5); if (num != 0) { return num; } num = comparer.Compare(this.m_Item6, tuple.m_Item6); if (num != 0) { return num; } return comparer.Compare(this.m_Item7, tuple.m_Item7); } /// Returns the hash code for the current object. /// A 32-bit signed integer hash code. [__DynamicallyInvokable] public override int GetHashCode() { return ((IStructuralEquatable)this).GetHashCode(EqualityComparer.Default); } /// Calculates the hash code for the current object by using a specified computation method. /// A 32-bit signed integer hash code. /// An object whose method calculates the hash code of the current object. [__DynamicallyInvokable] int IStructuralEquatable.GetHashCode(IEqualityComparer comparer) { return Tuple.CombineHashCodes(comparer.GetHashCode(this.m_Item1), comparer.GetHashCode(this.m_Item2), comparer.GetHashCode(this.m_Item3), comparer.GetHashCode(this.m_Item4), comparer.GetHashCode(this.m_Item5), comparer.GetHashCode(this.m_Item6), comparer.GetHashCode(this.m_Item7)); } int ITuple.GetHashCode(IEqualityComparer comparer) { return ((IStructuralEquatable)this).GetHashCode(comparer); } /// Returns a string that represents the value of this instance. /// The string representation of this object. [__DynamicallyInvokable] public override string ToString() { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append("("); return ((ITuple)this).ToString(stringBuilder); } string ITuple.ToString(StringBuilder sb) { sb.Append(this.m_Item1); sb.Append(", "); sb.Append(this.m_Item2); sb.Append(", "); sb.Append(this.m_Item3); sb.Append(", "); sb.Append(this.m_Item4); sb.Append(", "); sb.Append(this.m_Item5); sb.Append(", "); sb.Append(this.m_Item6); sb.Append(", "); sb.Append(this.m_Item7); sb.Append(")"); return sb.ToString(); } } /// Represents an n-tuple, where n is 8 or greater. /// The type of the tuple's first component. /// The type of the tuple's second component. /// The type of the tuple's third component. /// The type of the tuple's fourth component. /// The type of the tuple's fifth component. /// The type of the tuple's sixth component. /// The type of the tuple's seventh component. /// Any generic Tuple object that defines the types of the tuple's remaining components. /// 2 [__DynamicallyInvokable] [Serializable] public class Tuple : IStructuralEquatable, IStructuralComparable, IComparable, ITuple { private readonly T1 m_Item1; private readonly T2 m_Item2; private readonly T3 m_Item3; private readonly T4 m_Item4; private readonly T5 m_Item5; private readonly T6 m_Item6; private readonly T7 m_Item7; private readonly TRest m_Rest; /// Gets the value of the current object's first component. /// The value of the current object's first component. [__DynamicallyInvokable] public T1 Item1 { [__DynamicallyInvokable] get { return this.m_Item1; } } /// Gets the value of the current object's second component. /// The value of the current object's second component. [__DynamicallyInvokable] public T2 Item2 { [__DynamicallyInvokable] get { return this.m_Item2; } } /// Gets the value of the current object's third component. /// The value of the current object's third component. [__DynamicallyInvokable] public T3 Item3 { [__DynamicallyInvokable] get { return this.m_Item3; } } /// Gets the value of the current object's fourth component. /// The value of the current object's fourth component. [__DynamicallyInvokable] public T4 Item4 { [__DynamicallyInvokable] get { return this.m_Item4; } } /// Gets the value of the current object's fifth component. /// The value of the current object's fifth component. [__DynamicallyInvokable] public T5 Item5 { [__DynamicallyInvokable] get { return this.m_Item5; } } /// Gets the value of the current object's sixth component. /// The value of the current object's sixth component. [__DynamicallyInvokable] public T6 Item6 { [__DynamicallyInvokable] get { return this.m_Item6; } } /// Gets the value of the current object's seventh component. /// The value of the current object's seventh component. [__DynamicallyInvokable] public T7 Item7 { [__DynamicallyInvokable] get { return this.m_Item7; } } /// Gets the current object's remaining components. /// The value of the current object's remaining components. [__DynamicallyInvokable] public TRest Rest { [__DynamicallyInvokable] get { return this.m_Rest; } } int ITuple.Size { get { return 7 + ((ITuple)((object)this.m_Rest)).Size; } } /// Initializes a new instance of the class. /// The value of the tuple's first component. /// The value of the tuple's second component. /// The value of the tuple's third component. /// The value of the tuple's fourth component /// The value of the tuple's fifth component. /// The value of the tuple's sixth component. /// The value of the tuple's seventh component. /// Any generic Tuple object that contains the values of the tuple's remaining components. /// /// is not a generic Tuple object. [__DynamicallyInvokable] public Tuple(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6, T7 item7, TRest rest) { if (!(rest is ITuple)) { throw new ArgumentException("ArgumentException_TupleLastArgumentNotATuple"); } this.m_Item1 = item1; this.m_Item2 = item2; this.m_Item3 = item3; this.m_Item4 = item4; this.m_Item5 = item5; this.m_Item6 = item6; this.m_Item7 = item7; this.m_Rest = rest; } /// Returns a value that indicates whether the current object is equal to a specified object. /// true if the current instance is equal to the specified object; otherwise, false. /// The object to compare with this instance. [__DynamicallyInvokable] public override bool Equals(object obj) { return ((IStructuralEquatable)this).Equals(obj, EqualityComparer.Default); } /// Returns a value that indicates whether the current object is equal to a specified object based on a specified comparison method. /// true if the current instance is equal to the specified object; otherwise, false. /// The object to compare with this instance. /// An object that defines the method to use to evaluate whether the two objects are equal. [__DynamicallyInvokable] bool IStructuralEquatable.Equals(object other, IEqualityComparer comparer) { if (other == null) { return false; } Tuple tuple = other as Tuple; return tuple != null && (comparer.Equals(this.m_Item1, tuple.m_Item1) && comparer.Equals(this.m_Item2, tuple.m_Item2) && comparer.Equals(this.m_Item3, tuple.m_Item3) && comparer.Equals(this.m_Item4, tuple.m_Item4) && comparer.Equals(this.m_Item5, tuple.m_Item5) && comparer.Equals(this.m_Item6, tuple.m_Item6) && comparer.Equals(this.m_Item7, tuple.m_Item7)) && comparer.Equals(this.m_Rest, tuple.m_Rest); } /// Compares the current object to a specified object and returns an integer that indicates whether the current object is before, after, or in the same position as the specified object in the sort order. /// A signed integer that indicates the relative position of this instance and in the sort order, as shown in the following table.ValueDescriptionA negative integerThis instance precedes .ZeroThis instance and have the same position in the sort order.A positive integerThis instance follows . /// An object to compare with the current instance. /// /// is not a object. [__DynamicallyInvokable] int IComparable.CompareTo(object obj) { return ((IStructuralComparable)this).CompareTo(obj, Comparer.Default); } /// Compares the current object to a specified object by using a specified comparer and returns an integer that indicates whether the current object is before, after, or in the same position as the specified object in the sort order. /// A signed integer that indicates the relative position of this instance and in the sort order, as shown in the following table.ValueDescriptionA negative integerThis instance precedes .ZeroThis instance and have the same position in the sort order.A positive integerThis instance follows . /// An object to compare with the current instance. /// An object that provides custom rules for comparison. /// /// is not a object. [__DynamicallyInvokable] int IStructuralComparable.CompareTo(object other, IComparer comparer) { if (other == null) { return 1; } Tuple tuple = other as Tuple; if (tuple == null) { throw new ArgumentException("ArgumentException_TupleIncorrectType"); } int num = comparer.Compare(this.m_Item1, tuple.m_Item1); if (num != 0) { return num; } num = comparer.Compare(this.m_Item2, tuple.m_Item2); if (num != 0) { return num; } num = comparer.Compare(this.m_Item3, tuple.m_Item3); if (num != 0) { return num; } num = comparer.Compare(this.m_Item4, tuple.m_Item4); if (num != 0) { return num; } num = comparer.Compare(this.m_Item5, tuple.m_Item5); if (num != 0) { return num; } num = comparer.Compare(this.m_Item6, tuple.m_Item6); if (num != 0) { return num; } num = comparer.Compare(this.m_Item7, tuple.m_Item7); if (num != 0) { return num; } return comparer.Compare(this.m_Rest, tuple.m_Rest); } /// Calculates the hash code for the current object. /// A 32-bit signed integer hash code. [__DynamicallyInvokable] public override int GetHashCode() { return ((IStructuralEquatable)this).GetHashCode(EqualityComparer.Default); } /// Calculates the hash code for the current object by using a specified computation method. /// A 32-bit signed integer hash code. /// An object whose method calculates the hash code of the current object. [__DynamicallyInvokable] int IStructuralEquatable.GetHashCode(IEqualityComparer comparer) { ITuple tuple = (ITuple)((object)this.m_Rest); if (tuple.Size >= 8) { return tuple.GetHashCode(comparer); } switch (8 - tuple.Size) { case 1: return Tuple.CombineHashCodes(comparer.GetHashCode(this.m_Item7), tuple.GetHashCode(comparer)); case 2: return Tuple.CombineHashCodes(comparer.GetHashCode(this.m_Item6), comparer.GetHashCode(this.m_Item7), tuple.GetHashCode(comparer)); case 3: return Tuple.CombineHashCodes(comparer.GetHashCode(this.m_Item5), comparer.GetHashCode(this.m_Item6), comparer.GetHashCode(this.m_Item7), tuple.GetHashCode(comparer)); case 4: return Tuple.CombineHashCodes(comparer.GetHashCode(this.m_Item4), comparer.GetHashCode(this.m_Item5), comparer.GetHashCode(this.m_Item6), comparer.GetHashCode(this.m_Item7), tuple.GetHashCode(comparer)); case 5: return Tuple.CombineHashCodes(comparer.GetHashCode(this.m_Item3), comparer.GetHashCode(this.m_Item4), comparer.GetHashCode(this.m_Item5), comparer.GetHashCode(this.m_Item6), comparer.GetHashCode(this.m_Item7), tuple.GetHashCode(comparer)); case 6: return Tuple.CombineHashCodes(comparer.GetHashCode(this.m_Item2), comparer.GetHashCode(this.m_Item3), comparer.GetHashCode(this.m_Item4), comparer.GetHashCode(this.m_Item5), comparer.GetHashCode(this.m_Item6), comparer.GetHashCode(this.m_Item7), tuple.GetHashCode(comparer)); case 7: return Tuple.CombineHashCodes(comparer.GetHashCode(this.m_Item1), comparer.GetHashCode(this.m_Item2), comparer.GetHashCode(this.m_Item3), comparer.GetHashCode(this.m_Item4), comparer.GetHashCode(this.m_Item5), comparer.GetHashCode(this.m_Item6), comparer.GetHashCode(this.m_Item7), tuple.GetHashCode(comparer)); default: return -1; } } int ITuple.GetHashCode(IEqualityComparer comparer) { return ((IStructuralEquatable)this).GetHashCode(comparer); } /// Returns a string that represents the value of this instance. /// The string representation of this object. [__DynamicallyInvokable] public override string ToString() { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append("("); return ((ITuple)this).ToString(stringBuilder); } string ITuple.ToString(StringBuilder sb) { sb.Append(this.m_Item1); sb.Append(", "); sb.Append(this.m_Item2); sb.Append(", "); sb.Append(this.m_Item3); sb.Append(", "); sb.Append(this.m_Item4); sb.Append(", "); sb.Append(this.m_Item5); sb.Append(", "); sb.Append(this.m_Item6); sb.Append(", "); sb.Append(this.m_Item7); sb.Append(", "); return ((ITuple)((object)this.m_Rest)).ToString(sb); } } }