Beispiel #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));
                }
            }
        }
Beispiel #2
0
 public static IEnumerable <TResult> Select <TResult>(this Range range, Func <int, TResult> selector)
 {
     return(range.AsEnumerable().Select(selector));
 }
Beispiel #3
0
 public static IEnumerable <TResult> Cast <TResult>(this Range range)
 {
     return(range.AsEnumerable().Cast <TResult>());
 }
Beispiel #4
0
 public static IEnumerator <int> GetEnumerator(this Range range)
 {
     return(range.AsEnumerable().GetEnumerator());
 }
Beispiel #5
0
 public static void Add(this ICollection <int> collection, Range range)
 {
     collection.Add(range.AsEnumerable());
 }
Beispiel #6
0
 public static IEnumerable <int> ToArray(this Range range)
 => range.AsEnumerable().ToArray();
Beispiel #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));
 }
Beispiel #8
0
 public static IEnumerable <TResult> SelectMany <TResult>(this Range range, Func <int, IEnumerable <TResult> > fun)
 {
     return(range.AsEnumerable().SelectMany(fun));
 }
Beispiel #9
0
 public static IEnumerable <int> Where(this Range range, Func <int, bool> fun)
 {
     return(range.AsEnumerable().Where(fun));
 }
Beispiel #10
0
 public static IEnumerable <int> Select(this Range range, Func <int, int> fun)
 {
     return(range.AsEnumerable().Select(fun));
 }
Beispiel #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();