IDictionary.cs 1.5 KB

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