List Remove - will remove the value from the list
List RemoveAt - will remove the index value
List Remove
List<int> intsList = new List<int>();
intsList.Add(100);
intsList.Add(200);
intsList.Add(300);
intsList.Add(400);
intsList.Add(500);
intsList.Remove(1);
Console.WriteLine("TOTAL COUNT "+intsList.Count);
foreach (int i in intsList)
{
Console.WriteLine(i);
}
OUTPUT:
List RemoveAt
List<int> intsList = new List<int>();
intsList.Add(100);
intsList.Add(200);
intsList.Add(300);
intsList.Add(400);
intsList.Add(500);
intsList.RemoveAt(1);
Console.WriteLine("TOTAL COUNT "+intsList.Count);
foreach (int i in intsList)
{
Console.WriteLine(i);
}
OUTPUT :
No comments:
Post a Comment