What is the difference between these statements
obj=null and obj.dispose()

Answer Posted / sanjeev

obj=null
when we use obj=null then this object has existence in
memory with no any value.

obj.dispose()
when we use obj.dispose() then the clr release the memory
and there are no any existence of that object into the
memory. so it will be better to use obj.dispose()

Note:- By default it is automatically disposed by the clr
when there are no any references in the left

Is This Answer Correct ?    8 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can you use foreach iteration on arrays in c#?

807


Explain get and set accessor properties?

691


Explain lock, monitors, and mutex object in threading.

710


Is Facebook a desktop application?

688


What is the difference between dispose() and finalize() methods in c#?

728


What is exe file in c#?

684


how to print invert pyramid in c#

1514


What is dictionary collection in c#?

695


What is reflection in c#?

682


What is the concept of strong names?

752


What is an Interface in C#?

749


What is the main method?

714


How do I use the 'using' keyword with multiple objects?

737


How do I register my code for use by classic com clients?

693


What is jit (just in time)?

755