0

I've seen some snippets of code do the following:

CalculateSum mySum = new CalculateSum(); { mySum.add(50); }; 

while other developers do it this way (without the enclosing braces:

CalculateSum mySum = new CalculateSum(); mySum.add(50); 

I understand that the first method ensures that the object is disposed of as soon as it falls out of scope but I thought that .NET garbage collector works well enough that you do not need the above.

Am I wrong? Is it still best practice?

3

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.