namespace Vurdalakov
{
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
static public class ObservableCollectionExtensions
{
static public void AddRange<T>(this ObservableCollection<T> observableCollection, IEnumerable<T> items)
{
foreach (var item in items)
{
observableCollection.Add(item);
}
}
}
}
Friday, April 19, 2013
C# extension method for a generic class
As an example, let's extend ObservableCollection class with AddRange method.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment