c# Dictionary.TryGetValue()的用法

当肯定字典中存在该键值对时,可使用:code myObject result = null; if (theDictionary.ContainsKey(id)) {     result = theDictionary[id];     //What ever you gonna do next... } 当在字典中不能肯定是否存在该键时须要使用TryGetValue,以减小一次没必要要的查找,
相关文章
相关标签/搜索