Add Range for ObservableCollection - CSharp System.Collections.ObjectModel

CSharp examples for System.Collections.ObjectModel:ObservableCollection

Description

Add Range for ObservableCollection

Demo Code


using System.Threading.Tasks;
using System.Text;
using System.Linq;
using System.Collections.ObjectModel;
using System.Collections.Generic;
using System.Collections;
using System;//w w  w . j av  a2  s .  c  o  m

public class Main{
        public static void AddRange<T>(this ObservableCollection<T> collection, IEnumerable<T> data)
        {
            foreach (var x in data)
            {
                collection.Add(x);
            }
        }
}

Related Tutorials