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 is an int c#?
Are tuples mutable c#?
Can we extend sealed class in c#?
I have a very important query in my mind. Please help me regarding this. I don't have any real time exp in .net. But I have a knowledge it .net. I got an offer from an MNC company as a software developer has I had kept 2 years of fake exp. Even though for this job I had worked hard to crack interview for about an year. So, I would like to know how difficult it will be for working in real time as I don't have real time exp. Please tell me as soon as possible bcoz I need to join by next month. Can i sustain over there for a longer time or not. And also let me know how to work pressure will be over there. Please help me regarding this. I'm getting tension thinking about it. Thank you.
What is the purpose of private constructor in c#?
What is the use of 'as' Keyword in C# ?
interface a { Method1() Method2() } class b: a { override Method1() override Method2() } what will happen & why?
What is use of hashtable in c#?
What is the use of 0 in c#?
what is collections in .net? why we use?
What is delegates & multicast delegate?
What is the Difference between value and reference type?