📌  相关文章
📜  如何在 c# 代码示例中将列表添加到 observablecollection

📅  最后修改于: 2022-03-11 14:48:42.144000             🧑  作者: Mango

代码示例1
var stringList = new List() {"1","2","3"};
//Use the contructor override to add the list to the new collection
var obStrings = new ObservableCollection(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(ob2list);