Click here to Skip to main content
15,895,667 members
Home / Discussions / C#
   

C#

 
GeneralRe: String Problem Pin
DaveyM6918-May-08 23:33
professionalDaveyM6918-May-08 23:33 
AnswerRe: String Problem Pin
KennyPatel17-May-08 5:12
KennyPatel17-May-08 5:12 
AnswerRe: String Problem Pin
Ravi Bhavnani17-May-08 8:08
professionalRavi Bhavnani17-May-08 8:08 
QuestionWMI Help Pin
StevenWalsh17-May-08 4:48
StevenWalsh17-May-08 4:48 
AnswerRe: WMI Help Pin
Mircea Puiu17-May-08 21:15
Mircea Puiu17-May-08 21:15 
QuestionCorp a selection from Image? Pin
jamilkhan00717-May-08 4:47
jamilkhan00717-May-08 4:47 
AnswerRe: Corp a selection from Image? Pin
Anthony Mushrow17-May-08 7:03
professionalAnthony Mushrow17-May-08 7:03 
QuestionAddressbook from Outlook 2003 Pin
daniel9917-May-08 4:40
daniel9917-May-08 4:40 
Questionmy Dictionary removal code correct? Pin
George_George17-May-08 3:25
George_George17-May-08 3:25 
AnswerRe: my Dictionary removal code correct? Pin
PIEBALDconsult17-May-08 4:09
mvePIEBALDconsult17-May-08 4:09 
GeneralRe: my Dictionary removal code correct? Pin
George_George17-May-08 4:14
George_George17-May-08 4:14 
GeneralRe: my Dictionary removal code correct? Pin
PIEBALDconsult17-May-08 5:29
mvePIEBALDconsult17-May-08 5:29 
GeneralRe: my Dictionary removal code correct? Pin
George_George17-May-08 21:15
George_George17-May-08 21:15 
GeneralRe: my Dictionary removal code correct? Pin
PIEBALDconsult18-May-08 5:02
mvePIEBALDconsult18-May-08 5:02 
GeneralRe: my Dictionary removal code correct? Pin
George_George19-May-08 1:02
George_George19-May-08 1:02 
GeneralRe: my Dictionary removal code correct? Pin
PIEBALDconsult19-May-08 12:58
mvePIEBALDconsult19-May-08 12:58 
GeneralRe: my Dictionary removal code correct? Pin
George_George20-May-08 4:02
George_George20-May-08 4:02 
GeneralRe: my Dictionary removal code correct? Pin
PIEBALDconsult20-May-08 14:17
mvePIEBALDconsult20-May-08 14:17 
GeneralRe: my Dictionary removal code correct? Pin
George_George21-May-08 0:35
George_George21-May-08 0:35 
AnswerRe: my Dictionary removal code correct? Pin
Guffa17-May-08 6:21
Guffa17-May-08 6:21 
If you remove an item from the dictionary, that will invalidate the enumerator that the foreach command is using, so it's not possible to remove items in a loop like that.

Do like this:
List<string> remove = new List<string>();
foreach (KeyValuePair<sting, foo=""> item in dic) if (item.Value.order > 100) remove.Add(item.Key);
foreach (string key in remove) dic.Remove(key);</sting,>


Despite everything, the person most likely to be fooling you next is yourself.

GeneralRe: my Dictionary removal code correct? Pin
George_George17-May-08 21:12
George_George17-May-08 21:12 
GeneralRe: my Dictionary removal code correct? Pin
Guffa18-May-08 1:40
Guffa18-May-08 1:40 
GeneralRe: my Dictionary removal code correct? Pin
George_George18-May-08 1:43
George_George18-May-08 1:43 
AnswerRe: my Dictionary removal code correct? Pin
Roger Alsing17-May-08 7:22
Roger Alsing17-May-08 7:22 
GeneralRe: my Dictionary removal code correct? Pin
George_George17-May-08 21:07
George_George17-May-08 21:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.