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 |
What are the benefits of using generics?
Is c# good for games?
What is unrecognized escape sequence in c#?
from web.config file with connection string who to interact means who to connect in gridview. in my system shows null something error what is the problem
What does || mean in programming?
what is the difference between int and Int32?
What is different between Static Constructor and Private Constructor?
How to transpose multi-dimensional array?
Is array reference type / value type ?
6 Answers Accenture, BirlaSoft,
Is it possible to have a static indexer in c#?
What are data types with examples?
Is exe is machine dependent?