class Item:IDisposable { int id; string Description; int price; public Item() { id = 0; Description = ""; price = 0; } public void Dispose() { Dispose(true); //Garbage collector GC.SuppressFinalize(this); } protected virtual void Dispose(bool disposing) { if (disposing) { // how to release resources ? } } }
This is my code
using (Item i = new Item()) { }
when the execution finish it should call to Dispose() method
Why use another method
protected virtual void Dispose(bool disposing)
like this
protected virtual void Dispose(bool disposing) { if (disposing) { // how to release resources ? } }
any way what is release resources ?
in my case how do i release my resources ?
Thank you very much