Class NonGenericList
Non generic list of objects
public class NonGenericList : IList, ICollection, IEnumerable
- Inheritance
-
NonGenericList
- Implements
- Derived
- Inherited Members
Constructors
NonGenericList(IList)
Initializes a new instance of the NonGenericList class.
public NonGenericList(IList list)
Parameters
list
IListThe list - container of objects.
Fields
list
The list - internal container of objects
protected IList list
Field Value
Properties
Count
Gets the number of elements contained in the ICollection.
public int Count { get; }
Property Value
IsFixedSize
Gets a value indicating whether the IList has a fixed size.
public bool IsFixedSize { get; }
Property Value
IsReadOnly
Gets a value indicating whether the IList is read-only.
public bool IsReadOnly { get; }
Property Value
IsSynchronized
Gets a value indicating whether access to the ICollection is synchronized (thread safe).
public bool IsSynchronized { get; }
Property Value
this[int]
Gets or sets the element at the specified index.
public object this[int index] { get; set; }
Parameters
index
intThe index.
Property Value
- object
Object at index
SyncRoot
Gets an object that can be used to synchronize access to the ICollection.
public object SyncRoot { get; }
Property Value
Methods
Add(object)
Adds an item to the IList.
public int Add(object value)
Parameters
Returns
- int
The position into which the new element was inserted.
Clear()
Removes all items from the IList.
public void Clear()
Contains(object)
Determines whether the IList contains a specific value.
public bool Contains(object value)
Parameters
Returns
CopyTo(Array, int)
Copies the elements of the ICollection to an Array, starting at a particular Array index.
public void CopyTo(Array array, int index)
Parameters
array
ArrayThe one-dimensional Array that is the destination of the elements copied from ICollection. The Array must have zero-based indexing.
index
intThe zero-based index in
array
at which copying begins.
GetEnumerator()
Returns an enumerator that iterates through a collection.
public IEnumerator GetEnumerator()
Returns
- IEnumerator
An IEnumerator object that can be used to iterate through the collection.
IndexOf(object)
Determines the index of a specific item in the IList.
public int IndexOf(object value)
Parameters
Returns
- 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.
public void Insert(int index, object value)
Parameters
Remove(object)
Removes the first occurrence of a specific object from the IList.
public void Remove(object value)
Parameters
RemoveAt(int)
Removes the IList item at the specified index.
public void RemoveAt(int index)
Parameters
index
intThe zero-based index of the item to remove.