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 is the difference between proc. Sent by val and by sub?

676


Are classes passed by reference in c#?

669


What is the purpose of reserved word using in c#?

672


Why are local variables stored in stack?

779


What does the keyword “virtual” declare for a method or property?

737


What are c# collections?

681


What is a delegate in c#?

686


what is a structure in c#

1029


What is difference between array and list?

703


What is a method signature?

749


Why do we use 0?

691


How can you access a private method of a class?

685


What is difference between dynamic and var in c#?

681


Explain the Different types of configuration files in .net?

770


Explain the use of virtual, sealed, override, and abstract method?

665