C# empty statement

Posted by dotnetdev on Stack Overflow See other posts from Stack Overflow or by dotnetdev
Published on 2010-05-19T22:11:32Z Indexed on 2010/05/19 22:20 UTC
Read the original article Hit count: 180

Filed under:

In C#, I can write something like:

using (new MyDisposableClass().MethodA());

The semicolon causes a compiler warning to be shown which states possible mistaken empty statement. I haven't run the above code but won't the method still be called?

What uses is there of this type of coding convention? I saw another thread on here about this but I ask in case there areny differences now/therefore different replies.

Thanks

© Stack Overflow or respective owner

Related posts about c#