Get and remove in Cache.cs

Topics: Developer Forum
Mar 4, 2010 at 9:15 AM

I was looking into Cache.cs in SharedCache.WinServiceCommon and noticed that the Get and Remove methods are using dict.ContainsKey before it does dict[key], a better way to to it is to use dict.TryGetValue, that way you are only accessing the dictionary ones, saving a litle time :)