Skip to content

Instantly share code, notes, and snippets.

@Chell0
Last active May 27, 2020 22:42
Show Gist options
  • Save Chell0/d1d0945ce3758d4aebaca5bfa49314e5 to your computer and use it in GitHub Desktop.
Save Chell0/d1d0945ce3758d4aebaca5bfa49314e5 to your computer and use it in GitHub Desktop.
ToObservableCollection
using System.Collections.Generic;
public static class CollectionExtensions
{
public static ObservableCollection<T> ToObservableCollection<T>(this IEnumerable<T> list)
{
var collection = new ObservableCollection<T>();
foreach (var item in list)
{
collection.Add(item);
}
return collection;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment