开发者

Behavior of ObservableCollection(IEnumerable) constructor

According to MSDN there is an overload for the ObservableCollection constructor to which you can pass an IEnumerable. According to the very short MSDN page th开发者_如何学Cis will make a "Copy" of the Ienumerable.

How do I determine how this will behave? Will the "Copy" be totally independent of the original or will changes made to the Ienumerable (Such as by a linq query) be reflected automatically in the ObservableCollection?

MSDN Page


This constructor walks through the items in the IEnumerable and adds each one to the ObservableCollection. Once this is finished the new ObservableCollection has nothing more to do with the IEnumerable (except that if you are dealing with a collection of reference types then the ObservableCollection will hold references to the same objects that were supplied by the IEnumerable).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜