Add Range of element to ICollection - CSharp System.Collections

CSharp examples for System.Collections:ICollection

Description

Add Range of element to ICollection

Demo Code


using System.Threading.Tasks;
using System.Text;
using System.Linq;
using System.Collections.Specialized;
using System.Collections.Generic;
using System;//  w  w  w  . j a v  a2s  .co m

public class Main{

        public static ICollection<T> AddRange<T>(this ICollection<T> list, IEnumerable<T> items)
        {
            foreach (var item in items)
            {
                list.Add(item);
            }
            return list;
        }
}

Related Tutorials