What does the interface IList do in C#?



The IList interface has a non-generic collection of objects that can be individually accessed by index.

The following are the properties of interface IList in C# −

Sr.No Property Name & Description
1 Count
Gets the number of elements contained in the ICollection.
2 isFixedSize
Gets a value indicating whether the IList has a fixed size.
3 isReadOnly
Gets a value indicating whether the IList is read-only.
4 isSynchronized
Gets a value indicating whether access to the ICollection is synchronized.
5 Item(Int32)
Gets or sets the element at the specified index.

The following are the methods of the IList interface −

Sr.No Property Name & Description
1 Add(Obj)
Adds an item to the IList.
2 Clear()
Removes all items from the IList
3 Contains(Obj)
Whether the list contains a specific value
4 GetEnumerator()
Returns an Enumerator
5 IndexOf(Obj)
Index of the specified item in the IList
6 Remove(Obj)
The method removes the first occurrence of a specific object.
Updated on: 2020-06-20T15:21:31+05:30

986 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements