Exemplo n.º 1
0
        /// <summary>
        /// Allows enumeration over indexable segments of the given list.
        /// </summary>
        public static IEnumerable <ReadOnlyListView <T> > Batch <T>(this ReadOnlyListView <T> source, IEnumerable <int> sizes)
        {
            int marker = 0;

            foreach (int n in sizes)
            {
                yield return(source.GetSubView(marker, n));

                marker += n;
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Determines whether two converted lists are same.
 /// </summary>
 /// <param name="other">Other list to compare.</param>
 /// <returns><see langword="true"/> if this view wraps the same source list and contains the same converter as other view; otherwise, <see langword="false"/>.</returns>
 public bool Equals(ReadOnlyListView <I, O> other) => ReferenceEquals(source, other.source) && Equals(mapper, other.mapper);