Friday 27 May 2016

c# using statement

As a rule, when you use an IDisposable object, you should declare and instantiate it in a using statement. The usingstatement calls the Dispose method on the object in the correct way, and (when you use it as shown earlier) it also causes the object itself to go out of scope as soon as Dispose is called. Within the using block, the object is read-only and cannot be modified or reassigned.

https://msdn.microsoft.com/en-CA/library/yh598w02.aspx

No comments:

Post a Comment