Click here to Skip to main content
15,897,360 members
Home / Discussions / C#
   

C#

 
GeneralRe: Foreach Pin
Saksida Bojan2-Oct-10 7:13
Saksida Bojan2-Oct-10 7:13 
GeneralRe: Foreach Pin
Luc Pattyn2-Oct-10 7:38
sitebuilderLuc Pattyn2-Oct-10 7:38 
AnswerRe: Foreach Pin
Henry Minute2-Oct-10 7:05
Henry Minute2-Oct-10 7:05 
GeneralRe: Foreach Pin
Luc Pattyn2-Oct-10 7:35
sitebuilderLuc Pattyn2-Oct-10 7:35 
GeneralRe: Foreach Pin
Henry Minute2-Oct-10 7:44
Henry Minute2-Oct-10 7:44 
GeneralRe: Foreach Pin
Luc Pattyn2-Oct-10 7:45
sitebuilderLuc Pattyn2-Oct-10 7:45 
GeneralRe: Foreach Pin
Henry Minute2-Oct-10 7:46
Henry Minute2-Oct-10 7:46 
GeneralRe: Foreach Pin
Dave Kreskowiak2-Oct-10 7:39
mveDave Kreskowiak2-Oct-10 7:39 
Henry Minute wrote:
Doing it the way you first proposed would be more greedy for system resources as (I think) GPFS() would be called on each iteration of the foreach loop,


No, it wouldn't. Your code is functionally identical to the OP's code. The code in the foreach's paranthesis is executed only once and the code in the curly braces is executed for each item in the collection returned by the paranthesis code.

Now, if the collection we modified by a background thread or by the code in the curly braces, then you've got a problem...

GeneralRe: Foreach Pin
Henry Minute2-Oct-10 7:45
Henry Minute2-Oct-10 7:45 
GeneralRe: Foreach Pin
Dave Kreskowiak2-Oct-10 10:04
mveDave Kreskowiak2-Oct-10 10:04 
GeneralRe: Foreach Pin
Luc Pattyn2-Oct-10 10:22
sitebuilderLuc Pattyn2-Oct-10 10:22 
GeneralRe: Foreach Pin
Henry Minute2-Oct-10 10:55
Henry Minute2-Oct-10 10:55 
GeneralRe: Foreach Pin
Luc Pattyn2-Oct-10 11:06
sitebuilderLuc Pattyn2-Oct-10 11:06 
GeneralRe: Foreach Pin
Henry Minute2-Oct-10 11:09
Henry Minute2-Oct-10 11:09 
GeneralRe: Foreach Pin
Luc Pattyn2-Oct-10 11:20
sitebuilderLuc Pattyn2-Oct-10 11:20 
QuestionConvert monochrome bitmap to ascii string to send to QLS-printer? Pin
Mats Eurén2-Oct-10 5:38
Mats Eurén2-Oct-10 5:38 
AnswerRe: Convert monochrome bitmap to ascii string to send to QLS-printer? Pin
Luc Pattyn2-Oct-10 5:45
sitebuilderLuc Pattyn2-Oct-10 5:45 
GeneralRe: Convert monochrome bitmap to ascii string to send to QLS-printer? Pin
Mats Eurén2-Oct-10 6:09
Mats Eurén2-Oct-10 6:09 
GeneralRe: Convert monochrome bitmap to ascii string to send to QLS-printer? Pin
Luc Pattyn2-Oct-10 6:16
sitebuilderLuc Pattyn2-Oct-10 6:16 
GeneralRe: Convert monochrome bitmap to ascii string to send to QLS-printer? Pin
Dave Kreskowiak2-Oct-10 6:17
mveDave Kreskowiak2-Oct-10 6:17 
GeneralRe: Convert monochrome bitmap to ascii string to send to QLS-printer? Pin
Mats Eurén2-Oct-10 7:08
Mats Eurén2-Oct-10 7:08 
GeneralRe: Convert monochrome bitmap to ascii string to send to QLS-printer? Pin
Dave Kreskowiak2-Oct-10 7:34
mveDave Kreskowiak2-Oct-10 7:34 
GeneralRe: Convert monochrome bitmap to ascii string to send to QLS-printer? Pin
Mats Eurén2-Oct-10 7:40
Mats Eurén2-Oct-10 7:40 
QuestionDataGridView with MySQL IndexOutOfRange error Pin
memorexr2-Oct-10 5:03
memorexr2-Oct-10 5:03 
AnswerRe: DataGridView with MySQL IndexOutOfRange error Pin
Luc Pattyn2-Oct-10 5:25
sitebuilderLuc Pattyn2-Oct-10 5:25 

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.