HashHelpers.SerializationInfoTable.cs 1.0 KB

1234567891011121314151617181920212223242526272829
  1. // Licensed to the .NET Foundation under one or more agreements.
  2. // The .NET Foundation licenses this file to you under the MIT license.
  3. // See the LICENSE file in the project root for more information.
  4. // Used by Hashtable and Dictionary's SeralizationInfo .ctor's to store the SeralizationInfo
  5. // object until OnDeserialization is called.
  6. using System.Threading;
  7. using System.Runtime.CompilerServices;
  8. using System.Runtime.Serialization;
  9. namespace System.Collections
  10. {
  11. internal static partial class HashHelpers
  12. {
  13. private static ConditionalWeakTable<object, SerializationInfo> s_serializationInfoTable;
  14. public static ConditionalWeakTable<object, SerializationInfo> SerializationInfoTable
  15. {
  16. get
  17. {
  18. if (s_serializationInfoTable == null)
  19. Interlocked.CompareExchange(ref s_serializationInfoTable, new ConditionalWeakTable<object, SerializationInfo>(), null);
  20. return s_serializationInfoTable;
  21. }
  22. }
  23. }
  24. }