将IList <T>附加到ObservableCollection <T>

Collection<T> is a wrapper around an IList<T>. The list may be attached in constructor. There is no other method provided, as far as I know.

Although ObservableCollection<T> is derived from Collection<T>, you cannot attach an IList<T>. An instance may be constructed from a List<T>, not from IList<T>, and the list is copied.

公共源代码似乎证实了上述观点。

  1. Is this inconsistency a bug?
  2. How do I attach my own IList<T> implementation to an ObservableCollection<T>? The solution must work with the standard ObservableCollection<T>.

我是C#的新手。谢谢。

评论