This post will discuss how to remove an element from a list at the given index in C#.

The List<T>.RemoveAt() method is the recommended way to remove an element at the specified index in a List<T>. The following code example demonstrates the usage of RemoveAt() method to remove an element at the index 2 in a List<T>.

Download  Run Code

 
The List<T>.RemoveAt() method throws a System.ArgumentOutOfRangeException if the specified index is out of range. The index parameter should be non-negative and less than the size of the list. We can easily handle it as follows:

Download  Run Code

That’s all about removing elements from a list at the given index in C#.