Quantcast
Channel: Visual C# forum
Viewing all articles
Browse latest Browse all 31927

Variable question

$
0
0

Is there any difference performance/resource wise between these two solutions? I'm thinking if recreating the x variable continually in the second example will use more resources and slow things down? Or any other disadvantages?

int x;
for (int i = 0; i < 100; i++)
  {
    x = i;
  }

for (int i = 0; i < 100; i++)
  {
   int x = i;
  }



Viewing all articles
Browse latest Browse all 31927

Trending Articles