Click here to Skip to main content
16,016,290 members
Home / Discussions / C#
   

C#

 
GeneralRe: foreach Dictionary Pin
George_George27-May-08 23:44
George_George27-May-08 23:44 
AnswerRe: foreach Dictionary Pin
J4amieC27-May-08 4:30
J4amieC27-May-08 4:30 
GeneralRe: foreach Dictionary Pin
George_George27-May-08 23:43
George_George27-May-08 23:43 
AnswerRe: foreach Dictionary Pin
The Nightcoder27-May-08 11:24
The Nightcoder27-May-08 11:24 
GeneralRe: foreach Dictionary Pin
George_George27-May-08 23:41
George_George27-May-08 23:41 
GeneralRe: foreach Dictionary Pin
Guffa28-May-08 2:11
Guffa28-May-08 2:11 
GeneralRe: foreach Dictionary Pin
George_George28-May-08 15:35
George_George28-May-08 15:35 
GeneralRe: foreach Dictionary Pin
Guffa28-May-08 22:32
Guffa28-May-08 22:32 
There are some things that would be complicated, impractical, or even impossible, to handle correctly if a dictionary would allow adding and removing items during enumeration. For example:

If the dictionary would allow adding of items, it would have to always add the items at the end of the collection, so that the new items would always be handled at the end of the loop. This means that the dictionary can not reuse any previously released entries.

The enumerator contains a reference to the current item. If that item would be removed, the reference would point to an item that no longer is a part of the collection.

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

GeneralRe: foreach Dictionary Pin
George_George31-May-08 2:37
George_George31-May-08 2:37 
GeneralRe: foreach Dictionary Pin
The Nightcoder28-May-08 2:44
The Nightcoder28-May-08 2:44 
GeneralRe: foreach Dictionary Pin
George_George28-May-08 15:49
George_George28-May-08 15:49 
GeneralRe: foreach Dictionary Pin
The Nightcoder28-May-08 21:48
The Nightcoder28-May-08 21:48 
GeneralRe: foreach Dictionary Pin
George_George31-May-08 2:36
George_George31-May-08 2:36 
GeneralRe: foreach Dictionary Pin
The Nightcoder2-Jun-08 2:20
The Nightcoder2-Jun-08 2:20 
GeneralRe: foreach Dictionary Pin
George_George3-Jun-08 2:36
George_George3-Jun-08 2:36 
GeneralRe: foreach Dictionary Pin
supercat96-Nov-08 9:12
supercat96-Nov-08 9:12 
GeneralRe: foreach Dictionary Pin
The Nightcoder28-May-08 22:01
The Nightcoder28-May-08 22:01 
Questionatomic operation of reference assignment? Pin
George_George27-May-08 3:40
George_George27-May-08 3:40 
AnswerRe: atomic operation of reference assignment? Pin
Guffa27-May-08 4:30
Guffa27-May-08 4:30 
GeneralRe: atomic operation of reference assignment? Pin
George_George27-May-08 23:54
George_George27-May-08 23:54 
GeneralRe: atomic operation of reference assignment? Pin
supercat910-Jul-08 7:07
supercat910-Jul-08 7:07 
AnswerRe: atomic operation of reference assignment? Pin
Guffa10-Jul-08 16:15
Guffa10-Jul-08 16:15 
GeneralRe: atomic operation of reference assignment? Pin
supercat910-Jul-08 18:21
supercat910-Jul-08 18:21 
AnswerRe: atomic operation of reference assignment? Pin
Zoltan Balazs27-May-08 4:46
Zoltan Balazs27-May-08 4:46 
GeneralRe: atomic operation of reference assignment? Pin
George_George27-May-08 23:55
George_George27-May-08 23:55 

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.