.NET Coding Best Practices -part 4

Mohammad Shoeb
.Net Programming
Published in
Jun 6, 2022

--

Doing memory deallocation for unmanaged object is best practices, and we should always put unmanage object creation (objects which are not part of .NET framework like Oracle object, File IO operator, or event heavy computation objects are advised to be put in using block for better memory deallocation for efficient program

Below are the ways of using statements

i. first is common to us

ii. try using second better approach of using, we just add to prefix using in object creation, no need to add braces and enclose code within it, memory will be deallocated when the program will go out of method scope, this feature is available from C# 8 onwards

--

--

Mohammad Shoeb
.Net Programming

Solution Architect (.NetFull stack, Multi cloud Architect) - Certified AWS, Azure, GCP Professional Architect