DictionaryEntry.cs 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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
  25. {
  26. return _key;
  27. }
  28. set
  29. {
  30. _key = value;
  31. }
  32. }
  33. public object Value
  34. {
  35. get
  36. {
  37. return _value;
  38. }
  39. set
  40. {
  41. _value = value;
  42. }
  43. }
  44. [EditorBrowsable(EditorBrowsableState.Never)]
  45. public void Deconstruct(out object key, out object value)
  46. {
  47. key = Key;
  48. value = Value;
  49. }
  50. }
  51. }