Exemple #1
0
 /// <summary>
 /// Inserts the key-value pair into the symbol table, overwriting the old value
 /// with the new value if the key is already in the symbol table.
 /// If the value is <tt>null</tt>, this effectively deletes the key from the symbol table.
 /// </summary>
 /// <param name="key">key the key</param>
 /// <param name="val">val the value</param>
 /// <exception cref="NullReferenceException">if <tt>key</tt> is <tt>null</tt></exception>
 public void Put(TKey key, TValue val)
 {
     if (key == null)
     {
         throw new NullReferenceException("called put() with null key");
     }
     if (val == null)
     {
         _st.Delete(key);
     }
     else
     {
         _st.Put(key, val);
     }
 }
Exemple #2
0
 /// <summary>
 /// Removes the key from this set (if the key is present).
 /// </summary>
 /// <param name="key">key the key</param>
 /// <exception cref="NullReferenceException">if <tt>key</tt> is <tt>null</tt></exception>
 public void Delete(TKey key)
 {
     if (key == null)
     {
         throw new NullReferenceException("called delete() with a null key");
     }
     _set.Delete(key);
 }