NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

Key Based Collections

Key based collections are non-sequenced collections that are accessed via a key typed as an Object. The key can be any type. Multiple key types are allowed. The example below shows the design pattern, implementers need only implement the methods that are appropriate to their collection. The Dictionary class is the default implementation of this pattern.

class <Value>Dictionary : ICollection, IDictionary{

   // ICollection
   public void ICollection.CopyTo(Array array, int index); //Creates an array of DictionaryEntries (private)
   IEnumerator ICollection.GetEnumerator(); //uses DictionaryEntries    //The return value must be castable to IDictionaryEnumerator
   //Used directly, the IEnumerator enumerates over the values. 
   //private

   public int Count {get;}; 
   public Object ICollection.SyncRoot {get;}; //private implementation
   public boolean ICollection.IsSynchronized {get;}; //private implementation


   // IDictionary
   public ICollection Keys {get;};
   public ICollection Values {get;};
   virtual void IDictionary.Add (Object key, Object value); 
//private implementation
   public virtual Object IDictionary.this[Object value]; 
//private implementation
   public virtual void Clear ();
   virtual void IDictionary.Remove (Object key); 
//private implementation
   public void CopyTo(DictionaryEntry[] array, int index);
   public IDictionaryEnumerator GetEnumerator ();


   // Design Pattern
   static  <Value>Dictionary  Synchronized (<Value>Dictionary dictionary);
   public <Value> Item [<Key> key];     // default index (set,get)
                                       //Sets if their, adds otherwise
   public virtual void Add (<Key> key, <Value> value);
   public virtual void Remove (<Key>  key);

}