Collection vs List C#
C# - ListThe List Show List |
Property | Usage |
---|---|
Items | Gets or sets the element at the specified index |
Count | Returns the total number of elements exists in the List |
Method | Usage |
---|---|
Add | Adds an element at the end of a List |
AddRange | Adds elements of the specified collection at the end of a List |
BinarySearch | Search the element and returns an index of the element. |
Clear | Removes all the elements from a List |
Contains | Checks whether the specified element exists or not in a List |
Find | Finds the first element based on the specified predicate function. |
Foreach | Iterates through a List |
Insert | Inserts an element at the specified index in a List |
InsertRange | Inserts elements of another collection at the specified index. |
Remove | Removes the first occurrence of the specified element. |
RemoveAt | Removes the element at the specified index. |
RemoveRange | Removes all the elements that match the supplied predicate function. |
Sort | Sorts all the elements. |
TrimExcess | Sets the capacity to the actual number of elements. |
TrueForAll | Determines whether every element in theList |