I have a MSIL/performance question:
Is there any difference between declaring a variable once and assigning
to it multiple times, and declaring and assigning multiple times?
For example:
// Begin sample
for(int i = 0; i < 100; i++)
{
StringBuilder sb = new StringBuilder();
...
}
// End sample
as opposed to
// Begin sample
StringBuilder sb;
for(int i = 0; i < 100; i++)
{
sb = new StringBuilder();
}
// End sample
Are those basically the same, or is there a performance advantage to
the second (or indeed first) method?
Cheers,
Mark