Exemplo n.º 1
0
 /// <summary>Return the typed value of an item of the tuple, given its position</summary>
 /// <typeparam name="TItem">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="TItem"/>.</returns>
 public TItem Get <TItem>(int index)
 {
     if (index > 0 || index < -1)
     {
         return(TupleHelpers.FailIndexOutOfRange <TItem>(index, 1));
     }
     return(TypeConverters.Convert <T1, TItem>(this.Item1));
 }
Exemplo n.º 2
0
 object?IVarTuple.this[int index]
 {
     get
     {
         if (index > 0 || index < -1)
         {
             return(TupleHelpers.FailIndexOutOfRange <object>(index, 1));
         }
         return(this.Item1);
     }
 }
Exemplo n.º 3
0
 object IReadOnlyList <object> .this[int index]
 {
     get
     {
         if (index > 0 || index < -1)
         {
             return(TupleHelpers.FailIndexOutOfRange <object>(index, 1));
         }
         return(this.Item1);
     }
 }