Home > DeveloperSection > Forums > What is purpose of dispose method
Anupam Mishra

Total Post:135

Points:949
Posted on    February-08-2016 11:28 PM

 C# C#  ASP.Net 
Ratings:


 1 Reply(s)
 418  View(s)
Rate this:
Hi Everyone,
I want to know what is purpose of dispose method and which scenario we used? Can anyone give me a solution?
Thank you.


John Smith

Total Post:102

Points:720
Posted on    February-11-2016 1:25 AM

 When we are  implementing a Dispose method in my application then it releases unmanaged resource used by my application. The .NET Framework garbage collector does not allocate or release unmanaged memory.

The pattern for disposing an object, referred to as a dispose pattern, imposes order on the lifetime of an object. The dispose pattern is used only for objects that access unmanaged resources, such as file and pipe handles, registry handles, wait handles, or pointers to blocks of unmanaged memory. This is because the garbage collector is very efficient at reclaiming unused managed objects, but it is unable to reclaim unmanaged objects.


Don't want to miss updates? Please click the below button!

Follow MindStick