C# | Removing a range of elements from the List Last Updated : 11 Jul, 2025 Summarize Comments Improve Suggest changes Share Like Article Like Report List<T>.RemoveRange(Int32, Int32) Method is used to remove a range of elements from the List<T>. Properties of List: It is different from the arrays. A list can be resized dynamically but arrays cannot.List class can accept null as a valid value for reference types and it also allows duplicate elements.If the Count becomes equals to Capacity then the capacity of the List increases automatically by reallocating the internal array. The existing elements will be copied to the new array before the addition of the new element. Syntax: public void RemoveRange (int index, int count); Parameters: index: It is the zero-based starting index of the range of elements which is to be removed. count: It is the number of the elements which is to be removed. Exceptions: ArgumentOutOfRangeException: If the index is less than zero or Count is less than zero.ArgumentException: If the index and Count do not denote a valid range of elements in the List<T>. Below programs illustrate the use of List<T>.RemoveRange(Int32, Int32) Method: Example 1: CSharp // C# Program to remove a range of // elements from the List using System; using System.Collections; using System.Collections.Generic; class Geeks { // Main Method public static void Main(String[] args) { // Creating an List<T> of strings List<String> firstlist = new List<String>(); // Adding elements to List firstlist.Add("Geeks"); firstlist.Add("For"); firstlist.Add("Geeks"); firstlist.Add("GFG"); firstlist.Add("C#"); firstlist.Add("Tutorials"); firstlist.Add("GeeksforGeeks"); // Displaying the elements of firstlist Console.WriteLine("Elements in List:\n"); foreach(string ele in firstlist) { Console.WriteLine(ele); } // removing 1 elements starting // from index 3 firstlist.RemoveRange(3, 1); Console.WriteLine(""); // Displaying the updated List Console.WriteLine("After Removing of elements:\n"); // Displaying the elements in List foreach(string ele in firstlist) { Console.WriteLine(ele); } } } Output: Elements in List: Geeks For Geeks GFG C# Tutorials GeeksforGeeks After Removing of elements: Geeks For Geeks C# Tutorials GeeksforGeeks Time Complexity: O(n) Auxiliary Space: O(n) Example 2: CSharp // C# Program to remove a range of // elements from the List using System; using System.Collections; using System.Collections.Generic; class Geeks { // Main Method public static void Main(String[] args) { // Creating an List<T> of Integers List<int> firstlist = new List<int>(); // Adding elements to List firstlist.Add(1); firstlist.Add(2); firstlist.Add(3); firstlist.Add(4); firstlist.Add(5); firstlist.Add(6); firstlist.Add(7); // Displaying the elements of firstlist Console.WriteLine("Elements in List:\n"); foreach(int ele in firstlist) { Console.WriteLine(ele); } // removing 2 elements starting // from index 3 i.e 3rd and 4th firstlist.RemoveRange(3, 2); Console.WriteLine(""); // Displaying the updated List Console.WriteLine("After Removing of elements:\n"); // Displaying the elements in List foreach(int ele in firstlist) { Console.WriteLine(ele); } } } Output: Elements in List: 1 2 3 4 5 6 7 After Removing of elements: 1 2 3 6 7 Time complexity: O(n) since using a loop Auxiliary Space: O(n) where n is size of the list Reference: https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.list-1.removerange?view=netframework-4.7.2 Comment More infoAdvertise with us Next Article C# | Remove a range of elements from the ArrayList K Kirti_Mangal Follow Improve Article Tags : C# CSharp-method CSharp-Generic-List CSharp-Collections-Namespace CSharp-Generic-Namespace +1 More Similar Reads C# | Removing all the elements from the List List class represents the list of objects which can be accessed by index. It comes under the System.Collection.Generic namespace. List class can be used to create a collection of different types like integers, strings etc. List class also provides the methods to search, sort, and manipulate lists. L 3 min read C# | Removing all the elements from the List List class represents the list of objects which can be accessed by index. It comes under the System.Collection.Generic namespace. List class can be used to create a collection of different types like integers, strings etc. List class also provides the methods to search, sort, and manipulate lists. L 3 min read C# | Remove a range of elements from the ArrayList ArrayList represents an ordered collection of an object that can be indexed individually. It is basically an alternative to an array. It also allows dynamic memory allocation, adding, searching and sorting items in the list. ArrayList.RemoveRange(Int32, Int32) method is used to remove a range of ele 3 min read C# | Remove a range of elements from the ArrayList ArrayList represents an ordered collection of an object that can be indexed individually. It is basically an alternative to an array. It also allows dynamic memory allocation, adding, searching and sorting items in the list. ArrayList.RemoveRange(Int32, Int32) method is used to remove a range of ele 3 min read C# | Removing the specified element from the List List.Remove(T) Method is used to remove the first occurrence of a specific object from the List. Properties of List: It is different from the arrays. A list can be resized dynamically but arrays cannot. List class can accept null as a valid value for reference types and it also allows duplicate elem 2 min read C# | Removing the specified element from the List List.Remove(T) Method is used to remove the first occurrence of a specific object from the List. Properties of List: It is different from the arrays. A list can be resized dynamically but arrays cannot. List class can accept null as a valid value for reference types and it also allows duplicate elem 2 min read Like