A simple question about object re-initialization

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • sowen

    #1

    A simple question about object re-initialization

    think about we have a private hashtable object (variable)

    we initialize the objects in some methods, now we create a cleanup
    method, we can either new


    1) hash = new HashTable();


    or


    2) hash.Clear();


    is there any difference? on speed and resource allocation


    I think for HashTable may be no different; what about a Disposable
    object?
    Will the first way creates garbage if we don't dispose the existed
    object?


    Thanks

Working...