There is a method aptly named Remove:
dict.Remove(keyId)
It will not raise the exception if key does not exist - handy!
If you do want to check existence of the key anyways, it will return false if it is unable to find a key (or unable to remove it for some other odd reason).
public bool Remove
( TKey key )
dict.Remove(keyId)
It will not raise the exception if key does not exist - handy!
If you do want to check existence of the key anyways, it will return false if it is unable to find a key (or unable to remove it for some other odd reason).
No comments:
Post a Comment