c# Dictionary.TryGetValue()的用法

當肯定字典中存在該鍵值對時,可使用:code myObject result = null; if (theDictionary.ContainsKey(id)) {     result = theDictionary[id];     //What ever you gonna do next... } 當在字典中不能肯定是否存在該鍵時須要使用TryGetValue,以減小一次沒必要要的查找,
相關文章
相關標籤/搜索