473,324 Members | 2,246 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Delete key from Dictionary (C# 2.0)

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.
--
Luigi

Oct 14 '08 #1
2 6074
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
Oct 14 '08 #2
Google for
C# dictionary msdn

first hit, then look at the methods.

--
Pete
====
http://mrpmorris.blogspot.com
http://www.capableobjects.com
Oct 14 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Amy G | last post by:
I have received such good help on this message board. I wonder if I might not get a little more help from you on this. I am at the point where I have two dictionaries, with information of a...
0
by: fowlertrainer | last post by:
Hello python-list, How to I delete key from dictionary ? Like this: d={1:'a'} d.delete(1) ???? --
2
by: Michal Januszczyk | last post by:
Hello. Sometimes I encounter the following problem: foreach( element of some collection) { delete this element; } of course, the runtime would not allow to modify
0
by: Ed | last post by:
All of a sudden my previously working code started throwing this error. from the SqlDatasource. I am using C# and Asp.net 2.0. Getting the following error: You have specified that your delete...
1
by: georgehernando | last post by:
I am looking for an efficient way to delete the elements of a Python dictionary based on an evaluation of the element's value. Delete all elements with value bigger than x. Thanks
8
by: Brian L. Troutwine | last post by:
I've got a problem that I can't seem to get my head around and hoped somebody might help me out a bit: I've got a dictionary, A, that is arbitarily large and may contains ints, None and more...
0
by: Gammazoni | last post by:
Hello, I have a code like that, which has been using by me, but now I need another one, which won't differ a lot, I hope. Please, analize it, I believe that here I'll find somebody with large luggage...
11
by: Dan Upton | last post by:
This might be more information than necessary, but it's the best way I can think of to describe the question without being too vague. The task: I have a list of processes (well, strings to...
0
by: Gary Herron | last post by:
Dan Upton wrote: Yes. Create a list of keys, and loop through it: pids = procs_dict.keys() for pid in pids: if procs_dict.poll() != None # do the counter updates del procs_dict Then the...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.