VOOZH about

URL: https://www.geeksforgeeks.org/c-sharp/c-sharp-remove-element-at-specified-index-of-collectiont/

⇱ C# | Remove element at specified index of Collection<T> - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

C# | Remove element at specified index of Collection<T>

Last Updated : 11 Jul, 2025
Collection<T>.RemoveAt(Int32) is used to remove the element at the specified index of the Collection<T>. Syntax:
public void RemoveAt (int index);
Here, index is the zero-based index of the element to remove. Exception: This method will give ArgumentOutOfRangeException if the index is less than zero OR index is equal to or greater than Count. Below given are some examples to understand the implementation in a better way: Example 1: Output:
Count : 5
A
B
C
D
E
Count : 4
A
B
D
E
Example 2:
Runtime Error:
Unhandled Exception: System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index
Note: This method is an O(n) operation, where n is Count. Reference:
Comment

Explore