Delete key from Dictionary (C# 2.0)

  • Thread starter Thread starter Luigi
  • Start date Start date
L

Luigi

Hi all,
I have a dictionary like this:

Dictionary<string, Objects>

How can I remove a key - and the associated values - from a dictionary?

Thanks in advance.
 
It happens that Luigi formulated :
Hi all,
I have a dictionary like this:

Dictionary<string, Objects>

How can I remove a key - and the associated values - from a dictionary?

Thanks in advance.

var dict = new Dictionary<string, object>();
// ...
dict.Remove("theKeyToRemove");


Hans Kesting
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top