c# Dictionary的TryGetValue的用法

若是遇到要取不肯定的数据的时候不能这么写:spa myObject result = null; if (theDictionary.ContainsKey(id)) { result = theDictionary[id]; //What ever you gonna do next... } 得用TryGetValue,以减小一次没必要要的查找:code myObject re
相关文章
相关标签/搜索