Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
May 15, 2021 03:38 am GMT

C Using Statements

Recently C# added "using" statements that can replace "using" blocks in many scenarios. It lets you auto-dispose of a disposable object at the end of the current block, rather than defining a brand new block.

This reduces the number of nested blocks your code needs. It's not unusual to have two nested using blocks, and that pushes your code way over. Now, you just need to structure your code so that it disposes at the end of the block (method, if/else block, old-fashioned using block, even a custom block).


Original Link: https://dev.to/jtenos/c-using-statements-3gbf

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To