Ejemplo n.º 1
0
        internal static void ForEach <TElem>(this IEnumerable <TElem> seq, Action <TElem> act)
        {
            IAnyIterable <TElem> elems = seq as IAnyIterable <TElem>;

            if (elems != null)
            {
                elems.ForEachWhile(item => {
                    act(item);
                    return(true);
                });
            }
            else if (seq is TElem[])
            {
                var arr = (TElem[])seq;
                for (var i = 0; i < arr.Length; i++)
                {
                    act(arr[i]);
                }
            }
            else
            {
                var list = seq as List <TElem>;
                if (list != null)
                {
                    list.ForEach(act);
                }
                else
                {
                    ForEachWhile(seq, x => {
                        act(x);
                        return(true);
                    });
                }
            }
        }
Ejemplo n.º 2
0
 public static void CheckNotEmpty <T>(this IAnyIterable <T> anyIterable)
 {
     if (anyIterable.IsEmpty())
     {
         throw Errors.Is_empty;
     }
 }
Ejemplo n.º 3
0
 internal static bool IsEmpty <T>(this IAnyIterable <T> seq)
 {
     return(seq.Length == 0);
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Constructs an IterableDebugView for the list.
 /// </summary>
 /// <param name="list"></param>
 public IterableDebugView(IAnyIterable <TElem> list)
 {
     Object = list;
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Constructs a debug view for the specified collection.
 /// </summary>
 /// <param name="list">The collection.</param>
 public SequentialDebugView(IAnyIterable <TElem> list)
 {
     zIterableView = new IterableDebugView <TElem>(list);
 }