C# List Methods
Let's see some useful list instance methods.
On this page
Overview
In C#, lists are derived from the .NET System.Collections.Generic
class.
Aside from Add()
, Insert()
and Remove()
here are other instance methods and properties we can use from System.Collections.Generic
.
Instance Methods
Instance methods and properties are called using the list instance. To access an instance method, type the list instance variable and a dot (.)
.
Here are other useful instance methods and properties you can use:
Clear()
Removes all elements in a List
Contains()
determines weather the List contains a specific value
Sort()
sorts the elements in the List
Count()
holds the total number of elements in the List
Reverse()
reverses the order of the elements in the List
Find()
finds the first element that matches the specified condition
🔚 end of document 🔚