IDictionary.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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;
  5. namespace System.Collections
  6. {
  7. // An IDictionary is a possibly unordered set of key-value pairs.
  8. // Keys can be any non-null object. Values can be any object.
  9. // You can look up a value in an IDictionary via the default indexed
  10. // property, Items.
  11. public interface IDictionary : ICollection
  12. {
  13. // Interfaces are not serializable
  14. // The Item property provides methods to read and edit entries
  15. // in the Dictionary.
  16. object this[object key]
  17. {
  18. get;
  19. set;
  20. }
  21. // Returns a collections of the keys in this dictionary.
  22. ICollection Keys
  23. {
  24. get;
  25. }
  26. // Returns a collections of the values in this dictionary.
  27. ICollection Values
  28. {
  29. get;
  30. }
  31. // Returns whether this dictionary contains a particular key.
  32. //
  33. bool Contains(object key);
  34. // Adds a key-value pair to the dictionary.
  35. //
  36. void Add(object key, object value);
  37. // Removes all pairs from the dictionary.
  38. void Clear();
  39. bool IsReadOnly
  40. { get; }
  41. bool IsFixedSize
  42. { get; }
  43. // Returns an IDictionaryEnumerator for this dictionary.
  44. new IDictionaryEnumerator GetEnumerator();
  45. // Removes a particular key from the dictionary.
  46. //
  47. void Remove(object key);
  48. }
  49. }