How to cast a List to an ObservableCollection in wpf?

后端 未结 4 1997
暖寄归人
暖寄归人 2021-02-05 11:09

I am in wpf, and have a generic list: List. Now I wish to cast it to a generic observable collections: ObservableCollection.

I understand I can iterate over the list and

4条回答
  •  走了就别回头了
    2021-02-05 11:53

    ObservableCollection has Conttructor for IEnumerable ObservableCollection

    ObservableCollection observable = 
            new ObservableCollection(yourListObject);
    

提交回复
热议问题