c# - How to Dispose an object using Dispose method -


this question has answer here:

how dispose managed or unmanaged objects using dispose method?

in application class implemented idisposable interface , gave overridden method dispose(). actual doubt how dispose managed or unmanaged code in dispose method.

public override void dispose() {    // should unmanaged objects?     // can make object set 'null'? } 

the dispose method works using statement. automatically called if using block closed.

class : idisposable {     public void dispose()     {         // dispose     } }  using (a = new a()) {  } 

you don't need override method, because defined in interface.

in case using leaved, dispose called.


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -