Click here to Skip to main content
15,900,973 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
what is the IDisposable class and why we inherite from it
Posted
Comments
[no name] 18-Mar-13 8:58am    
Did you do any research at all?
ZurdoDev 18-Mar-13 9:00am    
I find it much easier to find a programming site, then create an account, then ask the question, don't you? :)
[no name] 18-Mar-13 9:20am    
Much easier than just reading the documentation.

This is quite a generic question so I would recommend starting here.[^] Then if you get stuck on a particular issue please ask a new question.
 
Share this answer
 
The primary use of this interface is to release unmanaged resources. The garbage collector automatically releases the memory allocated to a managed object when that object is no longer used. However, it is not possible to predict when garbage collection will occur. Furthermore, the garbage collector has no knowledge of unmanaged resources such as window handles, or open files and streams.
 
Share this answer
 
Hi,

You can refer MSDN Article[^]

I always prefer to read MSDN before reading any other article.

IDisposable interface is used when you want your object to be disposed in your application. It is good practice to dispose any unused object in your application. This will save your Memory and disposed memory can be used somewhere else.

Let me know if you need more information.

Thanks
-Amit
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900