diff options
Diffstat (limited to 'src/System.Private.CoreLib/shared/System/Collections/HashHelpers.SerializationInfoTable.cs')
-rw-r--r-- | src/System.Private.CoreLib/shared/System/Collections/HashHelpers.SerializationInfoTable.cs | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/System.Private.CoreLib/shared/System/Collections/HashHelpers.SerializationInfoTable.cs b/src/System.Private.CoreLib/shared/System/Collections/HashHelpers.SerializationInfoTable.cs new file mode 100644 index 000000000..d91dfd878 --- /dev/null +++ b/src/System.Private.CoreLib/shared/System/Collections/HashHelpers.SerializationInfoTable.cs @@ -0,0 +1,29 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +// Used by Hashtable and Dictionary's SeralizationInfo .ctor's to store the SeralizationInfo +// object until OnDeserialization is called. + +using System.Threading; +using System.Runtime.CompilerServices; +using System.Runtime.Serialization; + +namespace System.Collections +{ + internal static partial class HashHelpers + { + private static ConditionalWeakTable<object, SerializationInfo> s_serializationInfoTable; + + public static ConditionalWeakTable<object, SerializationInfo> SerializationInfoTable + { + get + { + if (s_serializationInfoTable == null) + Interlocked.CompareExchange(ref s_serializationInfoTable, new ConditionalWeakTable<object, SerializationInfo>(), null); + + return s_serializationInfoTable; + } + } + } +}
\ No newline at end of file |