System.Collections.Generic.IList<T>

Added in .NET 2.0
The standard interface for indexable collections
It supports all the methods of ICollection<T> and IEnumerable<T>
get the value of set the value at any position (index value)
find the index of a particular value
Insert at a particular index position
Remove an item at a particular index position


public interface IList<T> : ICollection<T>, IEnumerable<T>, IEnumerable 

System.Collections.Generic.List

Represents a strongly typed list of objects


Generic.List<T> or Generic.IList<T>

List<T>
Is a specific implementation of IList
Is a bloated type that contains a lot of properties and methods you might not need, such as AddRange().
Not designed to be extended, you cannot override any of the members


IList<T>
Is a more loosly coupled interface
Provides the bare minimum contract
Can easily be extended
Should be used by a public facing API
Lets you implement this and inherit from another class at the same time.



Methods

Add
Clear
Contains
CopyTo
GetEnumerator
IndexOf
Insert
Remove
RemoveAt


Properties

IsFixed
IsReadOnly



© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited TopPrevNext