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
).
精彩评论