DictionaryEntry.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. using System.ComponentModel;
  5. namespace System.Collections
  6. {
  7. // A DictionaryEntry holds a key and a value from a dictionary.
  8. // It is returned by IDictionaryEnumerator::GetEntry().
  9. [Serializable]
  10. [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
  11. public struct DictionaryEntry
  12. {
  13. private object _key; // Do not rename (binary serialization)
  14. private object? _value; // Do not rename (binary serialization)
  15. // Constructs a new DictionaryEnumerator by setting the Key
  16. // and Value fields appropriately.
  17. public DictionaryEntry(object key, object? value)
  18. {
  19. _key = key;
  20. _value = value;
  21. }
  22. public object Key
  23. {
  24. get => _key;
  25. set => _key = value;
  26. }
  27. public object? Value
  28. {
  29. get => _value;
  30. set => _value = value;
  31. }
  32. [EditorBrowsable(EditorBrowsableState.Never)]
  33. public void Deconstruct(out object key, out object? value)
  34. {
  35. key = Key;
  36. value = Value;
  37. }
  38. }
  39. }