/// <summary>Inserts an item to the <see cref="T:System.Collections.Generic.IList{T}"/> at the specified index.</summary>
/// <param name="index">The zero-based index at which <paramref name="item"/> should be inserted.</param>
/// <param name="item">The object to insert into the <see cref="T:System.Collections.Generic.IList{T}"/>.</param>
/// <exception cref="T:System.ArgumentOutOfRangeException"><paramref name="index"/> is not a valid index in the <see cref="T:System.Collections.Generic.IList{T}"/>.</exception>
/// <exception cref="T:System.NotSupportedException">The <see cref="T:System.Collections.Generic.IList{T}"/> is read-only.</exception>
publicvoidInsert(intindex,Titem)
{
if(hashtable.ContainsKey(index))
hashtable[index]=item;
else
hashtable.Add(index,item);
}
/// <summary>Removes the <see cref="T:System.Collections.Generic.IList{T}"/> item at the specified index.</summary>
/// <param name="index">The zero-based index of the item to remove.</param>
/// <exception cref="T:System.ArgumentOutOfRangeException"><paramref name="index"/> is not a valid index in the <see cref="T:System.Collections.Generic.IList{T}"/>.</exception>
/// <exception cref="T:System.NotSupportedException">The <see cref="T:System.Collections.Generic.IList{T}"/> is read-only.</exception>
publicvoidRemoveAt(intindex)
{
hashtable.Remove(index);
}
/// <summary>Gets or sets the element at the specified index.</summary>
/// <param name="index">The index of the element.</param>
/// <value>The element at the specified index.</value>
/// <summary>Adds an item to the <see cref="T:System.Collections.Generic.ICollection{T}"/>.</summary>
/// <param name="item">The object to add to the <see cref="T:System.Collections.Generic.ICollection{T}"/>.</param>
/// <exception cref="T:System.NotSupportedException">The <see cref="T:System.Collections.Generic.ICollection{T}"/> is read-only.</exception>
voidICollection<T>.Add(Titem)
{
thrownewNotSupportedException();
}
/// <summary>
/// Copies the elements of the <see cref="T:System.Collections.Generic.ICollection{T}"/> to an <see cref="T:System.Array"/>, starting at a particular <see
/// cref="T:System.Array"/> index.
/// </summary>
/// <param name="array">
/// The one-dimensional <see cref="T:System.Array"/> that is the destination of the elements copied from <see
/// cref="T:System.Collections.Generic.ICollection{T}"/>. The <see cref="T:System.Array"/> must have zero-based indexing.
/// </param>
/// <param name="arrayIndex">The zero-based index in <paramref name="array"/> at which copying begins.</param>
/// <exception cref="T:System.ArgumentNullException"><paramref name="array"/> is null.</exception>
/// <exception cref="T:System.ArgumentOutOfRangeException"><paramref name="arrayIndex"/> is less than 0.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="array"/> is multidimensional.-or- <paramref name="arrayIndex"/> is equal to or greater than the length of <paramref
/// name="array"/>.-or-The number of elements in the source <see cref="T:System.Collections.Generic.ICollection{T}"/> is greater than the available space
/// from <paramref name="arrayIndex"/> to the end of the destination <paramref name="array"/>.-or-Type <c>T</c> cannot be cast automatically to the type
/// of the destination <paramref name="array"/>.
/// </exception>
publicvoidCopyTo(T[]array,intarrayIndex)
{
hashtable.Values.CopyTo(array,arrayIndex);
}
/// <summary>Gets the number of elements contained in the <see cref="T:System.Collections.Generic.ICollection{T}"/>.</summary>
/// <returns>The number of elements contained in the <see cref="T:System.Collections.Generic.ICollection{T}"/>.</returns>
publicintCount=>hashtable.Count;
/// <summary>Gets a value indicating whether the <see cref="T:System.Collections.Generic.ICollection{T}"/> is read-only.</summary>
/// <returns>true if the <see cref="T:System.Collections.Generic.ICollection{T}"/> is read-only; otherwise, false.</returns>
publicboolIsReadOnly=>false;
/// <summary>Removes the first occurrence of a specific object from the <see cref="T:System.Collections.Generic.ICollection{T}"/>.</summary>
/// <param name="item">The object to remove from the <see cref="T:System.Collections.Generic.ICollection{T}"/>.</param>
/// <returns>
/// true if <paramref name="item"/> was successfully removed from the <see cref="T:System.Collections.Generic.ICollection{T}"/>; otherwise, false. This
/// method also returns false if <paramref name="item"/> is not found in the original <see cref="T:System.Collections.Generic.ICollection{T}"/>.
/// </returns>
/// <exception cref="T:System.NotSupportedException">The <see cref="T:System.Collections.Generic.ICollection{T}"/> is read-only.</exception>
publicboolRemove(Titem)
{
varidx=IndexOf(item);
if(idx==-1)
returnfalse;
RemoveAt(idx);
returntrue;
}
/// <summary>Collapses array into new, condensed array. Does not maintain indexes.</summary>
/// <returns>An array of <typeparamref name="T"/></returns>