This method is used to remove the value with the specified key from the Dictionary<TKey,TValue>.
Syntax:
public bool Remove (TKey key);
Return Value: This method returns
true if the element is successfully found and removed; otherwise it returns
false. This method returns false if key is not found in the Dictionary.
Exception: This method will give
ArgumentNullException if the
key is null.
Below are the programs to illustrate the use of above-discussed method:
Example 1:
Output:
Total key/value pairs in myDict are : 6
After remove operation
Total key/value pairs in myDict are : 5
Example 2: