Example #1
0
        public static IEnumerable <TResult> SelectMany <TResult>(this Range range, Func <int, Range> fun1, Func <int, int, TResult> fun2)
        {
            foreach (var s in range.AsEnumerable())
            {
                var range2 = fun1(s);

                foreach (var t in range2.AsEnumerable())
                {
                    yield return(fun2(s, t));
                }
            }
        }
Example #2
0
 public static IEnumerable <TResult> Select <TResult>(this Range range, Func <int, TResult> selector)
 {
     return(range.AsEnumerable().Select(selector));
 }
Example #3
0
 public static IEnumerable <TResult> Cast <TResult>(this Range range)
 {
     return(range.AsEnumerable().Cast <TResult>());
 }
Example #4
0
 public static IEnumerator <int> GetEnumerator(this Range range)
 {
     return(range.AsEnumerable().GetEnumerator());
 }
Example #5
0
 public static void Add(this ICollection <int> collection, Range range)
 {
     collection.Add(range.AsEnumerable());
 }
Example #6
0
 public static IEnumerable <int> ToArray(this Range range)
 => range.AsEnumerable().ToArray();
Example #7
0
 public static IEnumerable <TResult> SelectMany <TCollection, TResult>(this Range range, Func <int, IEnumerable <TCollection> > fun1, Func <int, TCollection, TResult> fun2)
 {
     return(Enumerable.SelectMany <int, TCollection, TResult>(range.AsEnumerable(), fun1, fun2));
 }
Example #8
0
 public static IEnumerable <TResult> SelectMany <TResult>(this Range range, Func <int, IEnumerable <TResult> > fun)
 {
     return(range.AsEnumerable().SelectMany(fun));
 }
Example #9
0
 public static IEnumerable <int> Where(this Range range, Func <int, bool> fun)
 {
     return(range.AsEnumerable().Where(fun));
 }
Example #10
0
 public static IEnumerable <int> Select(this Range range, Func <int, int> fun)
 {
     return(range.AsEnumerable().Select(fun));
 }
Example #11
0
 public static IEnumerable <int> Take(this Range range, int n)
 {
     return(range.AsEnumerable().Take(n));
 }
 /// <summary>
 /// Range GetEnumerator method, allows foreach over a range as long as the indices are not from the end
 /// </summary>
 /// <param name="range">Range to get the Enumerator for</param>
 /// <returns>An enumerator over the entire range</returns>
 /// <exception cref="ArgumentException">If any of the indices are marked as from the end</exception>
 public static IEnumerator <int> GetEnumerator(this Range range) => range.AsEnumerable().GetEnumerator();