📅  最后修改于: 2022-03-11 14:49:13.754000             🧑  作者: Mango
var list = new List>();
list.Add(new KeyValuePair("Cat", 1));
list.Add(new KeyValuePair("Dog", 2));
list.Add(new KeyValuePair("Rabbit", 4));
int removalStatus = list.RemoveAll(x => x.Key == "Rabbit");
if (removalStatus == 1)
{
list.Add(new KeyValuePair("Rabbit", 5));
}