Last active
May 27, 2020 22:42
-
-
Save Chell0/d1d0945ce3758d4aebaca5bfa49314e5 to your computer and use it in GitHub Desktop.
ToObservableCollection
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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