J
Joe
Consider the following code loop:
for(int x = 0; x < 100; x++)
{
string sLoop = "Loop # " + (x+1).ToString();
Console.WriteLine(x);
}
I was told that the (x+1).ToString() was a boxing statement, and would
therefore cause a memory leak because there's no explicit unboxing
statements. Now granted this is a simplistic example, and wouldn't
normally be found in a real-workld application. But it's not uncommon to
see statements such as (x+1).ToString(), so how would you explicitly
un-box this?
for(int x = 0; x < 100; x++)
{
string sLoop = "Loop # " + (x+1).ToString();
Console.WriteLine(x);
}
I was told that the (x+1).ToString() was a boxing statement, and would
therefore cause a memory leak because there's no explicit unboxing
statements. Now granted this is a simplistic example, and wouldn't
normally be found in a real-workld application. But it's not uncommon to
see statements such as (x+1).ToString(), so how would you explicitly
un-box this?