From 61d6a817e39d3bae0f47dbc09838d51db22a5d30 Mon Sep 17 00:00:00 2001 From: Jiyoung Yun Date: Tue, 13 Jun 2017 18:47:36 +0900 Subject: Imported Upstream version 2.0.0.11992 --- .../src/System/Collections/Generic/Dictionary.cs | 44 ---------------------- 1 file changed, 44 deletions(-) (limited to 'src/mscorlib/src/System/Collections/Generic/Dictionary.cs') diff --git a/src/mscorlib/src/System/Collections/Generic/Dictionary.cs b/src/mscorlib/src/System/Collections/Generic/Dictionary.cs index e360eef897..cd33428ca1 100644 --- a/src/mscorlib/src/System/Collections/Generic/Dictionary.cs +++ b/src/mscorlib/src/System/Collections/Generic/Dictionary.cs @@ -17,29 +17,6 @@ ** thread safety. If a reader writer lock is available, then that may be used ** with a Dictionary to get the same thread safety guarantee. ** -** Reader writer locks don't exist in silverlight, so we do the following as a -** result of removing non-generic collections from silverlight: -** 1. If the Hashtable was fully synchronized, then we replace it with a -** Dictionary with full locks around reads/writes (same thread safety -** guarantee). -** 2. Otherwise, the Hashtable has the default MR/SW thread safety behavior, -** so we do one of the following on a case-by-case basis: -** a. If the race condition can be addressed by rearranging the code and using a temp -** variable (for example, it's only populated immediately after created) -** then we address the race condition this way and use Dictionary. -** b. If there's concern about degrading performance with the increased -** locking, we ifdef with FEATURE_NONGENERIC_COLLECTIONS so we can at -** least use Hashtable in the desktop build, but Dictionary with full -** locks in silverlight builds. Note that this is heavier locking than -** MR/SW, but this is the only option without rewriting (or adding back) -** the reader writer lock. -** c. If there's no performance concern (e.g. debug-only code) we -** consistently replace Hashtable with Dictionary plus full locks to -** reduce complexity. -** d. Most of serialization is dead code in silverlight. Instead of updating -** those Hashtable occurences in serialization, we carved out references -** to serialization such that this code doesn't need to build in -** silverlight. ===========================================================*/ namespace System.Collections.Generic @@ -706,22 +683,6 @@ namespace System.Collections.Generic value = default(TValue); return false; } - - // Method similar to TryGetValue that returns the value instead of putting it in an out param. - public TValue GetValueOrDefault(TKey key) => GetValueOrDefault(key, default(TValue)); - - // Method similar to TryGetValue that returns the value instead of putting it in an out param. If the entry - // doesn't exist, returns the defaultValue instead. - public TValue GetValueOrDefault(TKey key, TValue defaultValue) - { - int i = FindEntry(key); - if (i >= 0) - { - return entries[i].value; - } - return defaultValue; - } - public bool TryAdd(TKey key, TValue value) => TryInsert(key, value, InsertionBehavior.None); bool ICollection>.IsReadOnly @@ -947,7 +908,6 @@ namespace System.Collections.Generic } } - [Serializable] public struct Enumerator : IEnumerator>, IDictionaryEnumerator { @@ -1076,7 +1036,6 @@ namespace System.Collections.Generic [DebuggerTypeProxy(typeof(Mscorlib_DictionaryKeyCollectionDebugView<,>))] [DebuggerDisplay("Count = {Count}")] - [Serializable] public sealed class KeyCollection : ICollection, ICollection, IReadOnlyCollection { private Dictionary dictionary; @@ -1227,7 +1186,6 @@ namespace System.Collections.Generic get { return ((ICollection)dictionary).SyncRoot; } } - [Serializable] public struct Enumerator : IEnumerator, System.Collections.IEnumerator { private Dictionary dictionary; @@ -1306,7 +1264,6 @@ namespace System.Collections.Generic [DebuggerTypeProxy(typeof(Mscorlib_DictionaryValueCollectionDebugView<,>))] [DebuggerDisplay("Count = {Count}")] - [Serializable] public sealed class ValueCollection : ICollection, ICollection, IReadOnlyCollection { private Dictionary dictionary; @@ -1455,7 +1412,6 @@ namespace System.Collections.Generic get { return ((ICollection)dictionary).SyncRoot; } } - [Serializable] public struct Enumerator : IEnumerator, System.Collections.IEnumerator { private Dictionary dictionary; -- cgit v1.2.3