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?
usingin it? Right now, there's absolutely no difference between the first and second version.