Difference between variable using and statement using?
Im just wondering if there is any difference to using a
using
statement by doing this:
as opposed to doing
4 Replies
Only difference is that
using (var foo = new Bar())
creates a new scope, at the end of which foo
is disposed. Using using var foo = new Bar();
will dispose foo
at the end of the method.so there isnt really any performance or memory difference?
No
Also the simple using statement still disposes at the end of the current scope
That might be the end of the method, or it might not
ok thank yall so much for clearing that up sorry if it was a simple question lol