I would recommend just creating a new instance of the object, rather than clearing it.
If you are finished with an object, but not a class containing its reference, setting it to null may be appropriate. However, if it is used only in the method, you don’t need to do anything (the garbage collector will clean it someday after there are no references to the object) - just let it “go away”, allowing it to drop out the volume. If it is in a collection, you can simply remove it from the collection.
The only exception is if the object implements IDisposable . In this case, you can call the Dispose() method or try to structure your code to use it in the using block so that its resources are cleaned accordingly.
source share