G
Guest
Hi
I usually stick to the convention of not declaring variables in my bodies of
"loops" (including foreach)
ie
int x;
for (int i = 0; i < 10; i++) {
x = ...
}
as opposed to
for (int i = 0; i < 10; i++) {
int x = ...
}
I've heard that in Java declaring variables within loops can cause problems
and I've tried to create some metrics to compare the difference in C# code
between prior to the loop and within the loop.
My results indicated that there was no difference.
I'd like to get a better idea from any one else as to whether my conclusion
is acurate or there is some form of performance hit.
Thanks in advance
AL
I usually stick to the convention of not declaring variables in my bodies of
"loops" (including foreach)
ie
int x;
for (int i = 0; i < 10; i++) {
x = ...
}
as opposed to
for (int i = 0; i < 10; i++) {
int x = ...
}
I've heard that in Java declaring variables within loops can cause problems
and I've tried to create some metrics to compare the difference in C# code
between prior to the loop and within the loop.
My results indicated that there was no difference.
I'd like to get a better idea from any one else as to whether my conclusion
is acurate or there is some form of performance hit.
Thanks in advance
AL