Zbi*_*iew 15
您可以使用ContainsKey和string.Contains:
var key = "tester";
var val = "testing";
if(myDictionary.ContainsKey(key) && myDictionary[key].Contains(val))
{
// "tester" key exists and contains "testing" value
}
Run Code Online (Sandbox Code Playgroud)
您还可以使用TryGetValue:
var key = "tester";
var val = "testing";
var dicVal = string.Empty;
if(myDictionary.TryGetValue(key, out dicVal) && dicVal.contains(val))
{
// "tester" key exists and contains "testing" value
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
26379 次 |
| 最近记录: |