Interface IList
Represents a non-generic collection of objects that can be individually accessed by index.
Inherited Members
Namespace: System.Collections
Assembly: mscorlib.dll
Syntax
public interface IList : ICollection, IEnumerable
Properties
IsFixedSize
Gets a value indicating whether the IList has a fixed size.
Declaration
bool IsFixedSize { get; }
Property Value
Type | Description |
---|---|
bool | true if the IList has a fixed size; otherwise, false. |
IsReadOnly
Gets a value indicating whether the IList is read-only.
Declaration
bool IsReadOnly { get; }
Property Value
Type | Description |
---|---|
bool | true if the IList is read-only; otherwise, false. |
this[int]
Gets or sets the element at the specified index.
Declaration
object this[int index] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
int | index | The zero-based index of the element to get or set. |
Property Value
Type | Description |
---|---|
object | The element at the specified index. |
Methods
Add(object)
Adds an item to the IList.
Declaration
int Add(object value)
Parameters
Type | Name | Description |
---|---|---|
object | value | The object to add to the IList. |
Returns
Type | Description |
---|---|
int | The position into which the new element was inserted, or -1 to indicate that the item was not inserted into the collection. |
Clear()
Removes all items from the IList.
Declaration
void Clear()
Contains(object)
Determines whether the IList contains a specific value.
Declaration
bool Contains(object value)
Parameters
Type | Name | Description |
---|---|---|
object | value | The object to locate in the IList. |
Returns
Type | Description |
---|---|
bool | true if the Object is found in the IList; otherwise, false. |
IndexOf(object)
Determines the index of a specific item in the IList.
Declaration
int IndexOf(object value)
Parameters
Type | Name | Description |
---|---|---|
object | value | The object to locate in the IList. |
Returns
Type | Description |
---|---|
int | The index of value if found in the list; otherwise, -1. |
Insert(int, object)
Inserts an item to the IList at the specified index.
Declaration
void Insert(int index, object value)
Parameters
Type | Name | Description |
---|---|---|
int | index | The zero-based index at which value should be inserted. |
object | value | The object to insert into the IList. |
Remove(object)
Removes the first occurrence of a specific object from the IList.
Declaration
void Remove(object value)
Parameters
Type | Name | Description |
---|---|---|
object | value | The object to remove from the IList. |
RemoveAt(int)
Removes the IList item at the specified index.
Declaration
void RemoveAt(int index)
Parameters
Type | Name | Description |
---|---|---|
int | index | The zero-based index of the item to remove. |