use of the Using keyword
Release resources:
Using using, or need try--catch
the Using principle:
The object is automatically reclaimed by the {}where the using is located .
The reason is that when we're going to go out {}, the system automatically calls the Dispose () method.
And that's how it's done in the DISpose method.
which objects can be used Using Recycling!
The type of the IDisposable interface must be implemented to use the using Recycle!
are managed or unmanaged resources recycled by using?
Parsing: What is managed: All C # code is supervised by the CLR,
the conclusion is that the using recycle is unmanaged Resources!
The using statement ensures that the Dispose method of a class is called at the earliest time (after the using statement is executed)as an example:using (String ss= "Diso"){//Execution Method}here the Dispose method of the string is called, and the Dispose method is called regardless of the way it exits the code block. Avoiding unexpected exceptions causes the Dispose method not to be calledusing a using statement will be invoked anyway
Using release resources