This type implements ICollection and IEnumerable.
mscorlib
BCL
Implemented by classes that support a collection of objects that can be individually indexed.
[Note: IList implementations fall into three categories: read-only, fixed-size, variable-size. A read-only list cannot be modified. A fixed-size list allows the modification of existing elements, but does not allow the addition or removal of elements. A variable-size list allows the modification, addition, and removal of elements.]
DefaultMemberAttribute("Item")
System.Collections Namespace
IList Methods
IList.Add Method
IList.Clear Method
IList.Contains Method
IList.IndexOf Method
IList.Insert Method
IList.Remove Method
IList.RemoveAt Method
IList Properties
IList.IsFixedSize Property
IList.IsReadOnly Property
IList.Item Property
Adds an item to the current instance.
- value
- The Object to add to the current instance.
A Int32 containing the index of the current instance into which the new element was inserted.
Exception Type Condition NotSupportedException The current instance is read-only or has a fixed size. 
[Behaviors: As described above.]
[Usage: Use the System.Collections.IList.Add(System.Object) method to add another element to the current instance. The index into which that element is added is implementation-dependent. ]
System.Collections.IList Interface, System.Collections Namespace
Removes all items from the current instance.
Exception Type Condition NotSupportedException The current instance is read-only. 
[Behaviors: As described above.]
[Overrides: Implementations of this method can vary in how a call to this method affects the capacity of a list. Typically, the count is set to zero. The capacity can be set to zero, some default, or remain unchanged.]
[Usage: Use this method to delete all values from the current instance.]
System.Collections.IList Interface, System.Collections Namespace
Determines whether the current instance contains a specific value.
- value
- The Object to locate in the current instance.
trueif the Object is found in the current instance; otherwise,false.
[Behaviors: As described above.]
[Usage: Use the System.Collections.IList.Contains(System.Object) method to determine if a particular Object is an element of the current instance.]
System.Collections.IList Interface, System.Collections Namespace
Determines the index of a specific item in the current instance.
- value
- The Object to locate in the current instance.
The index of value if found in the current instance; otherwise, -1.
[Behaviors: As described above.]
[Overrides: The default implementations of this method use System.Object.Equals(System.Object) to search for value in the current instance.]
[Usage: Use System.Collections.IList.IndexOf(System.Object) to determine if a Object is contained in the current instance and, if it is contained, its index in the current instance.]
System.Collections.IList Interface, System.Collections Namespace
Inserts an item to the current instance at the specified position.
- index
- A Int32 that specifies the zero-based index at which value is inserted.
- value
- The Object to insert into the current instance.
Exception Type Condition ArgumentOutOfRangeException index is not a valid index in the current instance (i.e. is greater than the number of elements in the current instance). NotSupportedException The current instance is read-only or has a fixed size. 
[Behaviors: If index equals the number of items in the IList, then value is required to be appended to the end of the current instance. ]
[Usage: Use System.Collections.IList.Insert(System.Int32,System.Object) to place a new element into a specific position in the current instance.]
System.Collections.IList Interface, System.Collections Namespace
Removes the first occurrence of a specified Object from the current instance.
- value
- The Object to remove from the current instance.
Exception Type Condition NotSupportedException The current instance is read-only or has a fixed size. 
[Behaviors: As described above.In addition, if value is
nullor is not found in the current instance, it is required that no exception be thrown and the current instance remain unchanged.]
[Overrides: The default implementations of this method use System.Object.Equals(System.Object) to search for value in the current instance.]
[Usage: Use System.Collections.IList.Remove(System.Object) to delete a specified Object from the current instance.]
System.Collections.IList Interface, System.Collections Namespace
Removes the item at the specified index of the current instance.
- index
- A Int32 that specifies the zero-based index of the item to remove.
Exception Type Condition ArgumentOutOfRangeException index is not a valid index in current instance. NotSupportedException The current instance is read-only or has a fixed size. 
[Behaviors: As described above.]
[Usage: Use System.Collections.IList.RemoveAt(System.Int32) to delete a specified Object from the current instance.]
System.Collections.IList Interface, System.Collections Namespace
bool IsFixedSize { get; }
Gets a Boolean value indicating whether the current instance has a fixed size.
trueif the current instance has a fixed size; otherwise,false.
This property is read-only.[Note: A collection with a fixed size does not allow the addition or removal of elements, but it allows the modification of existing elements.]
[Behaviors: Any method that adds or removes an element of a collection is required to check the value of this property for the particular collection before adding or removing elements. If the value of this property is
false, any attempt to add or remove an element of the current instance is required to throw a NotSupportedException.]
[Default: The default of this property is
false.]
[Overrides: Override this property, setting the value to
true, in order to prevent the addition or removal of elements in the current instance.]
[Usage: Use System.Collections.IList.IsFixedSize to secure the current instance from modification from methods, such as System.Collections.IList.Add(System.Object) and System.Collections.IList.Remove(System.Object), which add or remove elements from a list.]
System.Collections.IList Interface, System.Collections Namespace
bool IsReadOnly { get; }
Gets a value indicating whether the current instance is read-only.
trueif the current instance is read-only; otherwise,false.
This property is read-only.[Note: A collection that is read-only does not allow the modification, addition, or removal of elements.]
[Behaviors: Any method that modifies, adds, or removes an element of a collection is required to check the value of this property for the particular collection before executing. If the value of this property is
false, any attempt to modify, add, or remove an element of the current instance is required to throw a NotSupportedException. ]
[Default: The default of this property is
false.]
[Overrides: Override this property, setting the value to
true, in order to prevent the modification, addition, or removal of elements in the current instance.]
[Usage: Use System.Collections.IList.IsReadOnly to secure the current instance from modification from methods, such as System.Collections.IList.Add(System.Object) and System.Collections.IList.Remove(System.Object), which modify, add, or remove elements from a list.]
System.Collections.IList Interface, System.Collections Namespace
object this[int index] { get; set; }
Gets or sets the element at the specified index in the current instance.
- index
- A Int32 that specifies the zero-based index of the element to get or set.
The element at the specified index in the current instance.
Exception Type Condition ArgumentOutOfRangeException index is not a valid index in the current instance. NotSupportedException The property is being set and the current instance is read-only. 
[Behaviors: As described above.]
[Usage: Use this property for subscript indexing for the current instance in the following form:
myCollection[index]. ]
System.Collections.IList Interface, System.Collections Namespace