[StructLayout(LayoutKind.Auto)]
public struct ValueTuple<T1, T2, T3, T4, T5, T6, T7, TRest>
: IEquatable<ValueTuple<T1, T2, T3, T4, T5, T6, T7, TRest>>, IStructuralEquatable, IStructuralComparable, IComparable, IComparable<ValueTuple<T1, T2, T3, T4, T5, T6, T7, TRest>>, IValueTupleInternal, ITuple
- where TRest : struct, ITuple
+ where TRest : struct
{
/// <summary>
/// The current <see cref="ValueTuple{T1, T2, T3, T4, T5, T6, T7, TRest}"/> instance's first component.
{
get
{
- return 7 + Rest.Length;
+ IValueTupleInternal rest = Rest as IValueTupleInternal;
+ return rest == null ? 8 : 7 + rest.Length;
}
}
return Item7;
}
- return Rest[index - 7];
+ IValueTupleInternal rest = Rest as IValueTupleInternal;
+ if (rest == null)
+ {
+ if (index == 7)
+ {
+ return Rest;
+ }
+ throw new IndexOutOfRangeException();
+ }
+ return rest[index - 7];
}
}
}