我有以下列表,我需要在其上运行 Contains() 或类似方法来检索与特定键关联的值。我该怎么做?我到处搜索并尝试了很多东西,但我似乎无法弄清楚。
List<KeyValuePair<string, int>> shopInventory = new List<KeyValuePair<string, int>>();
Run Code Online (Sandbox Code Playgroud)
我认为它是这样的:
shopInventory.Contains((KeyValuePair<string, int>
Run Code Online (Sandbox Code Playgroud)
如果我忽略了任何重要信息,我会很乐意提供。