user2609378
user2609378

Reputation: 53

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?

Upvotes: 5

Views: 3406

Answers (2)

first of all I have list collection I converted into a I Enumerable collection. after that I returned that collection.

List<string> stringing=new List<string>();
IEnumerable<string> inalterableness=new IEnumerable<string>();
return inalterableness; 

Upvotes: 0

Abbas Galiyakotwala
Abbas Galiyakotwala

Reputation: 3019

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

ObservableCollection<string> myCollection = new ObservableCollection<string>(Result);

Upvotes: 6

Related Questions