Answers for "c# remove item from list if"

C#
23

how to delete from a list c#

var resultList = new List<int>();
resultList.Add(1);
resultList.Add(2);
resultList.Add(3);

// Removes the number 1 from the index 0 in the list
resultlist.RemoveAt(0);

// Allows you to remove an Object from the list instead
var itemToRemove = resultlist.Single(r => r.Id == 2);
resultList.Remove(itemToRemove);
Posted by: Guest on December-17-2019
2

remove items from list c# condition

prods.RemoveAll(s => s.ID == 1)
Posted by: Guest on May-20-2020

C# Answers by Framework

Browse Popular Code Answers by Language