What does Dispose method do with the connection object?

Answers were Sorted based on User's Feedback



What does Dispose method do with the connection object?..

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 does Dispose method do with the connection object?..

Answer / guest

Deletes it from the memory.

Is This Answer Correct ?    3 Yes 6 No

Post New Answer

More C Sharp Interview Questions

What is an int c#?

0 Answers  


Are tuples mutable c#?

0 Answers  


Can we extend sealed class in c#?

0 Answers  


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.

1 Answers  


What is the purpose of private constructor in c#?

0 Answers  






What is the use of 'as' Keyword in C# ?

0 Answers   HCL,


interface a { Method1() Method2() } class b: a { override Method1() override Method2() } what will happen & why?

5 Answers  


What is use of hashtable in c#?

0 Answers  


What is the use of 0 in c#?

0 Answers  


what is collections in .net? why we use?

0 Answers  


What is delegates & multicast delegate?

2 Answers   Cognizant,


What is the Difference between value and reference type?

12 Answers   Wipro,


Categories