static vs instance classes and the GC

  • Thread starter Thread starter news.austin.rr.com
  • Start date Start date
N

news.austin.rr.com

hi,

if I create a class for use as a static class (all methods and properties
are static) doesn't it reside on the stack instead of the heap and doesn't
that mean that GC will process faster since there are fewer objects on the
heap? So is this a valid speed enhancement? I realized there are pros and
cons to making a class purely static but if it can be made static isn't it
best for execution speed?

Thanks
 
In my view that is definitely not a valid speed enhancement. The memory will
still be used (and will only be free when the appdomain exits), you may save
the 4 bytes for the reference and that is not worth the time it took me to
type this sentence.

Cheers
Daniel
 
Back
Top