AddRange<T>()

using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;

namespace ReflectionIT.WPF {

    public static class Extensions {

        public static void AddRange<T>(this ObservableCollection<T> oc, IEnumerable<T> collection) {
            if (collection == null) {
                throw new ArgumentNullException("collection");
            }
            foreach (var item in collection)
            {
                oc.Add(item);
            }

            
        }
    }
}
Example:
list.AddRange(anotherList);

Description

I have created this AddRange<T>() method on ObservableCollection<T> because the LINQ Concat() method didn't trigger the CollectionChanged event. This method does.

Details

Double click on the code to select all.

 

;