questions

  • Thread starter Thread starter nahur
  • Start date Start date
N

nahur

1> can you put a value type on the HEAP ?

2> when would you use Idisposable over implementing a destrouctor

many thanks
 
nahur said:
1> can you put a value type on the HEAP ?

Value types end up on the heap if they are members of reference types
(directly or indirectly), or if they are boxed, or if they're static
members.

See http://www.pobox.com/~skeet/csharp/memory.html
2> when would you use Idisposable over implementing a destrouctor

If you have a finalizer, you should *always* implement IDisposable, so
that the resources can be released earlier and SuppressFinalize can be
called.
 
Back
Top