Example #1
0
 public static PipedFunction <IEnumerable <string>, IEnumerable <TOutput> > ParseAllTo <TOutput>()
 => Piped.FromFunc <IEnumerable <string>, IEnumerable <TOutput> >(list => list.Select(str =>
 {
     var descr = TypeDescriptor.GetConverter(typeof(TOutput));
     if (descr.CanConvertFrom(typeof(string)))
     {
         return((TOutput)descr.ConvertFromString(str));
     }
     throw Error(nameof(ParseAllTo));
 }));
Example #2
0
 public static PipedFunction <string, string> Join(string separator, params string[] strArray) =>
 Piped.FromFunc <string, string>(str => string.Join(separator, new[] { str }.Union(strArray)));
Example #3
0
 public static PipedFunction <IEnumerable <TInput>, IEnumerable <TInput> > Where(Func <TInput, bool> filter) =>
 Piped.FromFunc <IEnumerable <TInput>, IEnumerable <TInput> >(list => list.Where(filter));
Example #4
0
 public static PipedFunction <IEnumerable <TInput>, IEnumerable <TOutput> > Select <TOutput>(Func <TInput, TOutput> selector) =>
 Piped.FromFunc <IEnumerable <TInput>, IEnumerable <TOutput> >(list => list.Select(selector));
Example #5
0
 public static PipedFunction <string, IEnumerable <string> > Split(params char[] separators) =>
 Piped.FromFunc <string, IEnumerable <string> >(str => str.Split(separators));