diff --git a/SharpTreeView/TreeFlattener.cs b/SharpTreeView/TreeFlattener.cs index 929dc6a..582ac67 100644 --- a/SharpTreeView/TreeFlattener.cs +++ b/SharpTreeView/TreeFlattener.cs @@ -9,7 +9,7 @@ namespace ICSharpCode.TreeView { - sealed class TreeFlattener : IList, INotifyCollectionChanged + sealed class TreeFlattener : IList, IList, INotifyCollectionChanged { /// /// The root node of the flat list tree. @@ -88,7 +88,7 @@ public int IndexOf(object item) } } - bool IList.IsReadOnly { + public bool IsReadOnly { get { return true; } } @@ -106,12 +106,12 @@ public int IndexOf(object item) } } - void IList.Insert(int index, object item) + public void Insert(int index, object item) { throw new NotSupportedException(); } - void IList.RemoveAt(int index) + public void RemoveAt(int index) { throw new NotSupportedException(); } @@ -121,7 +121,12 @@ int IList.Add(object item) throw new NotSupportedException(); } - void IList.Clear() + public void Add(object item) + { + throw new NotSupportedException(); + } + + public void Clear() { throw new NotSupportedException(); } @@ -137,16 +142,34 @@ public void CopyTo(Array array, int arrayIndex) array.SetValue(item, arrayIndex++); } + public void CopyTo(object[] array, int arrayIndex) + { + foreach (object item in this) + array.SetValue(item, arrayIndex++); + } + void IList.Remove(object item) { throw new NotSupportedException(); } + public bool Remove(object item) + { + throw new NotSupportedException(); + } + public IEnumerator GetEnumerator() { for (int i = 0; i < this.Count; i++) { yield return this[i]; } } + + IEnumerator IEnumerable.GetEnumerator() + { + for (int i = 0; i < this.Count; i++) { + yield return this[i]; + } + } } }