diff --git a/ImageListView/ImageListViewSelectedItemCollection.cs b/ImageListView/ImageListViewSelectedItemCollection.cs index 2589208..de14b30 100644 --- a/ImageListView/ImageListViewSelectedItemCollection.cs +++ b/ImageListView/ImageListViewSelectedItemCollection.cs @@ -155,7 +155,12 @@ void ICollection.Clear() /// The zero-based index in at which copying begins. void ICollection.CopyTo(ImageListViewItem[] array, int arrayIndex) { - throw new NotSupportedException(); + int i = 0; + foreach (ImageListViewItem item in this) + { + array[arrayIndex + i] = item; + i++; + } } /// /// Determines the index of a specific item in the . @@ -164,10 +169,16 @@ void ICollection.CopyTo(ImageListViewItem[] array, int arrayI /// /// The index of if found in the list; otherwise, -1. /// - [Obsolete("Use ImageListViewItem.Index property instead.")] int IList.IndexOf(ImageListViewItem item) { - throw new NotSupportedException(); + int i = 0; + foreach (ImageListViewItem selectedItem in this) + { + if (selectedItem == item) + return i; + i++; + } + return -1; } /// /// Inserts an item to the at the specified index. @@ -204,7 +215,7 @@ ImageListViewItem IList.this[int index] { get { - throw new NotSupportedException(); + return this[index]; } set { @@ -323,4 +334,4 @@ public void Reset() #endregion } } -} \ No newline at end of file +}