private static int GetEnumerator(Func <int> handler) { int count = -1; for (int i = 0; i < PER_TEST; i++) { count = 0; if (handler != null) { foreach (var sub in handler.AsEnumerable()) { count += sub(); } } } return(count); }
private static int GetEnumerator_CheckSingle(Func <int> handler) { int count = -1; for (int i = 0; i < PER_TEST; i++) { count = 0; if (handler == null) { } else if (handler.IsSingle()) { count = handler(); } else { foreach (var sub in handler.AsEnumerable()) { count += sub(); } } } return(count); }
public ISequenceBuilder Or(Func <ICommandOutput> returnValue) { _results.Add(returnValue.AsEnumerable()); return(this); }
/// <summary> /// Returns the sequence or a singleton default value sequence if it's empty. /// </summary> /// <typeparam name="T">Source sequence element type.</typeparam> /// <param name="source">Source sequence.</param> /// <param name="defaultValue">Default value.</param> /// <returns>Original sequence or the default value.</returns> public static Func <Func <Maybe <T> > > DefaultIfEmpty <T>(this Func <Func <Maybe <T> > > source, T defaultValue) { return(source.AsEnumerable().DefaultIfEmpty(defaultValue).AsFEnumerable()); }
/// <summary> /// Sorts the elements in the sequence by the selected key value in descending order. /// </summary> /// <typeparam name="T">Source sequence element type.</typeparam> /// <typeparam name="K">Key type.</typeparam> /// <param name="source">Source sequence.</param> /// <param name="keySelector">Key selector.</param> /// <returns>Ordered sequence.</returns> public static Func <Func <Maybe <T> > > OrderByDescending <T, K>(this Func <Func <Maybe <T> > > source, Func <T, K> keySelector) { return(new OrderedWrapper <T>(source.AsEnumerable().OrderByDescending(keySelector)).GetEnumerator); }
protected ISequenceBuilder Either(Func<ICommandOutput> returnValue) { return new SequenceBuilder(returnValue.AsEnumerable()); }