C# List Methods

Let's see some useful list instance methods.

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

list list

Contains()

determines weather the List contains a specific value

list list

Sort()

sorts the elements in the List

list list

Count()

holds the total number of elements in the List

Reverse()

reverses the order of the elements in the List

list list

Find()

finds the first element that matches the specified condition

list list list


🔚 end of document 🔚

References