You should throw an ArgumentNullExcception
. Most of the .NET Framework extension methods do this. Alternatively, do nothing and let the ObservableCollection<T>
constructor do it.
public static ObservableCollection<TSource> ToObservableCollection<TSource>(this IEnumerable<TSource> source)
{
if (source == null)
{
throw new ArgumentNullException("source");
}
return new ObservableCollection<TSource>(source);
}