System/PCL: Implement HttpWebRequest.SupportsCookieContainer, WebRequest.CreateHttp...
[mono.git] / mcs / class / System / System.Collections.Generic / SortedList.cs
index 2eaec862bda11b699875eb110f37849fb71b1134..5ee7bfb94eebc42654b120cef9e0bae72ee06b1b 100644 (file)
@@ -169,10 +169,10 @@ namespace System.Collections.Generic
 
                object IDictionary.this [object key] {
                        get {
-                               if (!(key is TKey))
-                                       return null;
-                               else
-                                       return this [(TKey)key];
+                               TValue obj;
+                               if (key is TKey && TryGetValue ((TKey)key, out obj))
+                                       return obj;
+                               return null;
                        }
 
                        set {