Skip to content
This repository was archived by the owner on Jul 21, 2025. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 28 additions & 5 deletions SharpTreeView/TreeFlattener.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

namespace ICSharpCode.TreeView
{
sealed class TreeFlattener : IList, INotifyCollectionChanged
sealed class TreeFlattener : IList, IList<object>, INotifyCollectionChanged
{
/// <summary>
/// The root node of the flat list tree.
Expand Down Expand Up @@ -88,7 +88,7 @@ public int IndexOf(object item)
}
}

bool IList.IsReadOnly {
public bool IsReadOnly {
get { return true; }
}

Expand All @@ -106,12 +106,12 @@ object ICollection.SyncRoot {
}
}

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();
}
Expand All @@ -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();
}
Expand All @@ -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<object> IEnumerable<object>.GetEnumerator()
{
for (int i = 0; i < this.Count; i++) {
yield return this[i];
}
}
}
}