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

What does string format do?

648


Explain About Web.config

742


What are extender provider components? Explain how to use an extender provider in the project.

678


Why can't we use a static class instead of singleton?

659


Enlist the different types of classes in c#?

713


What is difference between virtual and override in c#?

640


What is data quality assurance?

641


What is a custom attribute?

657


Is enum a class c#?

677


What is executescalar in c#?

639


When should you use generics?

696


How do you use nullable?

677


What are the properties in c#?

684


Why do we parse in c#?

638


Can you declare a field readonly?

718