Example #1
0
 public static IEnumerator <V> AsEnumerator <V, T>(T source)
 {
     if (typeof(T) == typeof(IEnumerator <V>))
     {
         return((IEnumerator <V>)source);
     }
     if (typeof(T) == typeof(IEnumerable <V>))
     {
         return(((IEnumerable <V>)source).GetEnumerator());
     }
     if (typeof(T) == typeof(V))
     {
         return(Source.Constant((V)(object)source));
     }
     if (typeof(T) == typeof(Func <V>))
     {
         return(Source.Function((Func <V>)(object) source));
     }
     throw new ArgumentException($"Expected {typeof(V).FullName} but was: {typeof(T).FullName}");
 }
Example #2
0
 public static IEnumerator <V> Constant <V>(V val)
 {
     return(Source.Constant(val));
 }