Re: memory leak or not?



No, when the variable is out of scope, it becomes eligible for garbage
collection.

"docschnipp" <docschnipp@xxxxxxxxxxxxxxxx> wrote in message
news:D52F0CD9-91F8-4238-A100-19BAC61089BA@xxxxxxxxxxxxxxxx
Does such a function result in a memory leak because of not explicitely
setting result = null?
------------------
public override string GetValueAsString()
{
StringBuilder result = new StringBuilder(10);
result.Append(Month.AsString());
result.Append('/');
result.Append(Day.AsString());
result.Append('/');
result.Append(Year.AsString());
return result.ToString();
}
------------------

Or does the compiler automatically gets that "result" goes off focus now?

best regards,
doc




.