Vous êtes sur la page 1sur 1

If you want to remove more than one item from the list in one go then

use RemoveRange method as shown in the following syntax:


LsitName.RemoveRange(num1,num2)
Note:
Num1 means the index of the item that you want to start removing.
Num2 means how many items from the determined index in num1 to be
removed.

Example:
List<string> name = new List<string>();
name.Add("Muhamad");
name.Add("Ahmad");
name.Add("Azad");
name.Add("Aram");
name.Add("Sidra");
name.RemoveRange(1,3);
foreach (string a in name)
Console.WriteLine(a);
The output will be
Muhamad
Sidra

Vous aimerez peut-être aussi