Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to convert List to observablecollection

Hi all I have a Json class as shown below:

private class RootObject
{
    public string flag { get; set; }
    public string message { get; set; }
    public Result result { get; set; }
}

public class Result
{
    public List<List<string>> professions { get; set; }
}

How can I convert the result class into an observable collection?

like image 234
user2609378 Avatar asked Jun 30 '15 04:06

user2609378


1 Answers

ObservableCollection<T> have constructor which takes IEnumerable<T>

ObservableCollection<string> myCollection = new ObservableCollection<string>(Result);
like image 144
Abbas Galiyakotwala Avatar answered Sep 23 '22 17:09

Abbas Galiyakotwala