What does Dispose method do with the connection object?
Answers were Sorted based on User's Feedback
Answer / abhishek
SqlConnection.Dispose - in addition to closing the connection, it also
clears stateful nature of the SqlConnection instance, like connection string
etc.Beneath this layer, in SqlConnection atleast, there is a connection
pooling mechanism, which eventually holds actual physical database
connections. Again, they aren't really unmanaged resources, but non .NET
resources nonetheless. Lest I cause any confusion SqlClient has TDS parsing
built into .NET code, so technically in this scenario - there wasn't any
unmanaged resource.
So in short, Dispose does not **have** to release unmanaged resources - and
by convention it does cleanup. Thats exactly what SqlConnection.Dispse
does - "clean up clean up everybody do your share"
Is This Answer Correct ? | 3 Yes | 1 No |
Why delegate is used in c#?
How long does it take to learn c# programming?
Do void methods have parameters?
What are extender provider components? Explain how to use an extender provider in the project.
what are the advantages of c# over vb.net?
10 Answers Choice Solutions, HCL, Practical Viva Questions,
how to access the virtual method without creating the objet for the virtual method?
Why dictionary is used in c#?
Hi, Can we implement the Abstract class on interface in c#, If yes then provide the code implementation
Why do we use namespace in c#?
Does the variables of a private class-level inherited?
Why do we need generics?
What is a generic method?