c# observablecollection to list code example

Example: how to add a list to observablecollection in c#

var stringList = new List<string>() {"1","2","3"};
//Use the contructor override to add the list to the new collection
var obStrings = new ObservableCollection<string>(stringList);

//If you already have a collection. Store that into a tempory list, 
//add the new range to the tempory list. Then same as above
var ob2list = obStrings.ToList();
ob2list.AddRange(stringList);
obStrings = new System.Collections.ObjectModel.ObservableCollection<string>(ob2list);