top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration

Facebook Login
Site Registration

How to Convert a List to ObservableCollection in C#?

+2 votes
303 views

I had an doubt regarding list to ObservableCollection in C#???

posted Oct 29, 2014 by Puhal

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote
    public static class ObservableExtensions
       {
      public static ObservableCollection<T> ToObservableCollection<T>(this List<T> items)
       {
        ObservableCollection<T> collection = new ObservableCollection<T>();

        foreach (var item in items)
        {
            collection.Add(item);
        }

        return collection;
        }
       }
answer Oct 30, 2014 by Jdk
Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Bangalore-560102
Karnataka INDIA.
QUERY HOME
...