/// <summary>Return the Nth item in this tuple</summary> public object this[int index] { get { switch (index) { case 0: case -5: return(this.Item1); case 1: case -4: return(this.Item2); case 2: case -3: return(this.Item3); case 3: case -2: return(this.Item4); case 4: case -1: return(this.Item5); default: STuple.FailIndexOutOfRange(index, 5); return(null); } } }
/// <summary>Return the typed value of an item of the tuple, given its position</summary> /// <typeparam name="R">Expected type of the item</typeparam> /// <param name="index">Position of the item (if negative, means relative from the end)</param> /// <returns>Value of the item at position <paramref name="index"/>, adapted into type <typeparamref name="R"/>.</returns> public R Get <R>(int index) { if (index > 0 || index < -1) { STuple.FailIndexOutOfRange(index, 1); } return(FdbConverters.Convert <T1, R>(this.Item1)); }
public object this[int index] { get { if (index > 0 || index < -1) { STuple.FailIndexOutOfRange(index, 1); } return(this.Item1); } }
/// <summary>Return the typed value of an item of the tuple, given its position</summary> /// <typeparam name="R">Expected type of the item</typeparam> /// <param name="index">Position of the item (if negative, means relative from the end)</param> /// <returns>Value of the item at position <paramref name="index"/>, adapted into type <typeparamref name="R"/>.</returns> public R Get <R>(int index) { switch (index) { case 0: case -2: return(FdbConverters.Convert <T1, R>(this.Item1)); case 1: case -1: return(FdbConverters.Convert <T2, R>(this.Item2)); default: STuple.FailIndexOutOfRange(index, 2); return(default(R)); } }
/// <summary>Return the typed value of an item of the tuple, given its position</summary> /// <typeparam name="R">Expected type of the item</typeparam> /// <param name="index">Position of the item (if negative, means relative from the end)</param> /// <returns>Value of the item at position <paramref name="index"/>, adapted into type <typeparamref name="R"/>.</returns> public R Get <R>(int index) { switch (index) { case 0: case -5: return(FdbConverters.Convert <T1, R>(this.Item1)); case 1: case -4: return(FdbConverters.Convert <T2, R>(this.Item2)); case 2: case -3: return(FdbConverters.Convert <T3, R>(this.Item3)); case 3: case -2: return(FdbConverters.Convert <T4, R>(this.Item4)); case 4: case -1: return(FdbConverters.Convert <T5, R>(this.Item5)); default: STuple.FailIndexOutOfRange(index, 5); return(default(R)); } }