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

Answer Posted / dhinaharan

obj.dispose has to be used and not obj=null, bcoz JIT
compiler is optimizing compiler, and setting a local
variable or parameter to null is the same as not
referencing the variable at all.

Is This Answer Correct ?    2 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are cshtml files?

681


What are the types of class in c#?

720


what is generics? can u explain 5 to 6 examples on generics that covers class,method,structure,list,delegates?

1675


How can we set the class to be inherited, but prevent the method from being over-ridden?

712


How do you implement thread synchronization in c#?

667


What is nullable types in c#?

703


How do I start a program in c#?

749


Why do we need serialization?

692


What is hashtable in c# with example?

713


What is the default value of guid in c#?

676


What is the difference between list and arraylist c#?

735


What is parallel foreach in c#?

760


What is the solution if you need to manipulate sets of items?

690


Should I make my destructor virtual?

827


What is string [] args in c#?

718