C# 如何从列表中删除条目<;KeyValuePair<;字符串,字符串>&燃气轮机;仅仅基于钥匙?
我有一个KeyValuerPair myList。如何根据密钥删除条目?我应该如何使用myList.Remove方法?我没有使用字典,因为我需要myList作为Bindingsource的数据源C# 如何从列表中删除条目<;KeyValuePair<;字符串,字符串>&燃气轮机;仅仅基于钥匙?,c#,.net,collections,C#,.net,Collections,我有一个KeyValuerPair myList。如何根据密钥删除条目?我应该如何使用myList.Remove方法?我没有使用字典,因为我需要myList作为Bindingsource的数据源 List<KeyValuePair<string, string>> myList = new List<KeyValuePair<string, string>>(); string key = "@index"; 谢谢你, VRP。使用。可以传入检
List<KeyValuePair<string, string>> myList = new List<KeyValuePair<string, string>>();
string key = "@index";
谢谢你,
VRP。使用。可以传入检查键值的谓词。
例如:
这很有效,非常感谢你的改善。如果我没有弄错的话,谓词是否作为委托,只是它只返回布尔值?
myList.Remove( i am lost here )
myList.RemoveAll(kvp => kvp.Key == "@index");