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}"); }
public static IEnumerator <V> Constant <V>(V val) { return(Source.Constant(val)); }