The Labs \ Source Viewer \ SSCLI \ System.Collections.Generic \ IDictionary

  1. // ==++==
  2. //
  3. //
  4. // Copyright (c) 2006 Microsoft Corporation. All rights reserved.
  5. //
  6. // The use and distribution terms for this software are contained in the file
  7. // named license.txt, which can be found in the root of this distribution.
  8. // By using this software in any fashion, you are agreeing to be bound by the
  9. // terms of this license.
  10. //
  11. // You must not remove this notice, or any other, from this software.
  12. //
  13. //
  14. // ==--==
  15. /*============================================================
  16. **
  17. ** Interface:  IDictionary
  18. **
  19. **
  20. ** Purpose: Base interface for all generic dictionaries.
  21. **
  22. **
  23. ===========================================================*/
  24. namespace System.Collections.Generic
  25. {
  26.     using System;
  27.    
  28.     // An IDictionary is a possibly unordered set of key-value pairs.
  29.     // Keys can be any non-null object. Values can be any object.
  30.     // You can look up a value in an IDictionary via the default indexed
  31.     // property, Items.
  32.    
  33.     public interface IDictionary<TKey, TValue> : ICollection<KeyValuePair<TKey, TValue>>
  34.     {
  35.         // Interfaces are not serializable
  36.         // The Item property provides methods to read and edit entries
  37.         // in the Dictionary.
  38.         TValue this[TKey key]
  39.         {
  40.             get;
  41.             set;
  42.         }
  43.        
  44.         // Returns a collections of the keys in this dictionary.
  45.         ICollection<TKey> Keys {
  46.             get;
  47.         }
  48.        
  49.         // Returns a collections of the values in this dictionary.
  50.         ICollection<TValue> Values {
  51.             get;
  52.         }
  53.        
  54.         // Returns whether this dictionary contains a particular key.
  55.         //
  56.         bool ContainsKey(TKey key);
  57.        
  58.         // Adds a key-value pair to the dictionary.
  59.         //
  60.         void Add(TKey key, TValue value);
  61.        
  62.         // Removes a particular key from the dictionary.
  63.         //
  64.         bool Remove(TKey key);
  65.        
  66.         bool TryGetValue(TKey key, out TValue value);
  67.     }
  68. }

Developer Fusion