Click here to Skip to main content
15,901,001 members
Home / Discussions / C#
   

C#

 
GeneralRe: Which is faster ? foreach OR for !! Pin
Luc Pattyn31-Mar-10 16:35
sitebuilderLuc Pattyn31-Mar-10 16:35 
GeneralRe: Which is faster ? foreach OR for !! Pin
Som Shekhar31-Mar-10 16:38
Som Shekhar31-Mar-10 16:38 
GeneralRe: Which is faster ? foreach OR for !! Pin
DaveyM691-Apr-10 6:06
professionalDaveyM691-Apr-10 6:06 
GeneralRe: Which is faster ? foreach OR for !! Pin
Hercule Poirot1-Apr-10 6:35
Hercule Poirot1-Apr-10 6:35 
JokeRe: Which is faster ? foreach OR for !! Pin
Eddy Vluggen31-Mar-10 15:51
professionalEddy Vluggen31-Mar-10 15:51 
GeneralRe: Which is faster ? foreach OR for !! Pin
Not Active31-Mar-10 16:05
mentorNot Active31-Mar-10 16:05 
GeneralRe: Which is faster ? foreach OR for !! Pin
AspDotNetDev31-Mar-10 17:30
protectorAspDotNetDev31-Mar-10 17:30 
AnswerRe: Which is faster ? foreach OR for !! Pin
PIEBALDconsult31-Mar-10 14:58
mvePIEBALDconsult31-Mar-10 14:58 
0) Yes, foreach may be more readable
1) for is generally quicker than foreach.
2) In some cases, you can't use for.
3) With foreach, you can't alter the collection
4) Breaking out of a foreach is generally poor design
4.1) Same with for, but you can set the test appropriately

In conclusion, it depends on the situation.
GeneralRe: Which is faster ? foreach OR for !! Pin
AspDotNetDev31-Mar-10 17:28
protectorAspDotNetDev31-Mar-10 17:28 
GeneralRe: Which is faster ? foreach OR for !! Pin
PIEBALDconsult31-Mar-10 18:19
mvePIEBALDconsult31-Mar-10 18:19 
GeneralRe: Which is faster ? foreach OR for !! Pin
AspDotNetDev31-Mar-10 19:21
protectorAspDotNetDev31-Mar-10 19:21 
Questionresume data - your idea plz... Pin
Jassim Rahma31-Mar-10 11:43
Jassim Rahma31-Mar-10 11:43 
AnswerRe: resume data - your idea plz... Pin
PIEBALDconsult31-Mar-10 11:52
mvePIEBALDconsult31-Mar-10 11:52 
GeneralRe: resume data - your idea plz... Pin
Jassim Rahma31-Mar-10 11:54
Jassim Rahma31-Mar-10 11:54 
GeneralRe: resume data - your idea plz... Pin
Super Lloyd31-Mar-10 12:31
Super Lloyd31-Mar-10 12:31 
GeneralRe: resume data - your idea plz... Pin
Jassim Rahma31-Mar-10 12:34
Jassim Rahma31-Mar-10 12:34 
GeneralRe: resume data - your idea plz... Pin
PIEBALDconsult31-Mar-10 13:40
mvePIEBALDconsult31-Mar-10 13:40 
GeneralRe: resume data - your idea plz... Pin
Not Active31-Mar-10 13:40
mentorNot Active31-Mar-10 13:40 
Questionmy code runs very slow with visual studio 2008 [modified] Pin
karayel_kara31-Mar-10 11:35
karayel_kara31-Mar-10 11:35 
AnswerRe: my code runs very slow with visual studio 2008 Pin
Luc Pattyn31-Mar-10 11:44
sitebuilderLuc Pattyn31-Mar-10 11:44 
AnswerRe: my code runs very slow with visual studio 2008 Pin
Som Shekhar1-Apr-10 0:27
Som Shekhar1-Apr-10 0:27 
GeneralRe: my code runs very slow with visual studio 2008 Pin
karayel_kara1-Apr-10 1:03
karayel_kara1-Apr-10 1:03 
GeneralRe: my code runs very slow with visual studio 2008 Pin
Som Shekhar1-Apr-10 1:06
Som Shekhar1-Apr-10 1:06 
QuestionReflection error running an application generated through CISCO's AXLAPI.wsdl class service generator Pin
Steve Holdorf31-Mar-10 10:49
Steve Holdorf31-Mar-10 10:49 
QuestionUnable to make cast ( what wrong with my code ... ? ) Pin
Yanshof31-Mar-10 10:01
Yanshof31-Mar-10 10:01 

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.