Click here to Skip to main content
15,890,282 members
Home / Discussions / C#
   

C#

 
Generaltricky sql & data set question Pin
mikemilano19-Aug-03 10:48
mikemilano19-Aug-03 10:48 
GeneralRe: tricky sql & data set question Pin
mikemilano19-Aug-03 10:58
mikemilano19-Aug-03 10:58 
GeneralRe: tricky sql & data set question Pin
Ista19-Aug-03 16:51
Ista19-Aug-03 16:51 
GeneralRe: tricky sql & data set question Pin
A.Wegierski19-Aug-03 19:18
A.Wegierski19-Aug-03 19:18 
GeneralRe: tricky sql & data set question Pin
Ista20-Aug-03 3:19
Ista20-Aug-03 3:19 
GeneralRe: tricky sql & data set question Pin
A.Wegierski20-Aug-03 19:20
A.Wegierski20-Aug-03 19:20 
GeneralRe: tricky sql & data set question Pin
Ista21-Aug-03 3:22
Ista21-Aug-03 3:22 
GeneralRe: tricky sql & data set question Pin
Ista21-Aug-03 3:50
Ista21-Aug-03 3:50 
Yes and no actually

The foreach statement repeats a group of embedded statements for each element in an array or an object collection. The foreach statement is used to iterate through the collection to get the desired information, but should not be used to change the contents of the collection to avoid unpredictable side effects. The statement takes the following form:

This doesnt mean you cant change the data in the elements of the collections just the contents of a collection.

Like so, if you add, delete, or sort the collection while inside an enumerator it will have un expected results for the simple fact that is an Enumerator and just grabs one time data. Much like modifying a pointer while iterating.

You can change the data inside the elements without it affecting them.

I have more than 20 classes linked to datagrids and use foreach to iterate through them and have not witnessed any unpredicted results yet. And besides all doc code shows ms using that especially in implementing collections.

Could use post a code example or detailed situation so I could try it and determine the root problem.

nick

I'm not an expert yet, but I play one at work. Yeah and here too.
GeneralRe: tricky sql & data set question Pin
A.Wegierski24-Aug-03 22:29
A.Wegierski24-Aug-03 22:29 
GeneralI formated my drive along with my project Pin
mdolby19-Aug-03 10:11
mdolby19-Aug-03 10:11 
GeneralRe: I formated my drive along with my project Pin
J. Dunlap19-Aug-03 10:18
J. Dunlap19-Aug-03 10:18 
QuestionHow do I find a file associated icon? Pin
Lars Fisker19-Aug-03 9:17
Lars Fisker19-Aug-03 9:17 
AnswerRe: How do I find a file associated icon? Pin
Heath Stewart19-Aug-03 9:46
protectorHeath Stewart19-Aug-03 9:46 
GeneralRe: How do I find a file associated icon? Pin
Lars Fisker19-Aug-03 10:48
Lars Fisker19-Aug-03 10:48 
QuestionTrapping the enter key? Pin
BoozeBomb19-Aug-03 8:57
BoozeBomb19-Aug-03 8:57 
AnswerRe: Trapping the enter key? Pin
Heath Stewart19-Aug-03 9:14
protectorHeath Stewart19-Aug-03 9:14 
GeneralRe: Trapping the enter key? Pin
BoozeBomb19-Aug-03 9:25
BoozeBomb19-Aug-03 9:25 
Generalasync delegates Pin
devvvy19-Aug-03 8:32
devvvy19-Aug-03 8:32 
GeneralRe: async delegates Pin
Heath Stewart19-Aug-03 9:26
protectorHeath Stewart19-Aug-03 9:26 
Generalsending mail with attachments Pin
Sprinkle19-Aug-03 7:57
Sprinkle19-Aug-03 7:57 
GeneralRe: sending mail with attachments Pin
Heath Stewart19-Aug-03 9:53
protectorHeath Stewart19-Aug-03 9:53 
QuestionDetermining radio button choice...??? Pin
vlusardi19-Aug-03 7:33
vlusardi19-Aug-03 7:33 
AnswerRe: Determining radio button choice...??? Pin
Heath Stewart19-Aug-03 9:56
protectorHeath Stewart19-Aug-03 9:56 
GeneralGIS in C# Pin
laphijia19-Aug-03 7:07
laphijia19-Aug-03 7:07 
GeneralUsing ActiveX control in C# Pin
Big Trev19-Aug-03 6:43
Big Trev19-Aug-03 6:43 

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.