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 is null in database?

538


What is yield in c#?

575


What is the difference between list and arraylist in c#?

481


What is the function of .IsDescendent()?

673


Is static class thread safe in c#?

591






Why do we parse in c#?

549


What is difference between dictionary and list in c#?

539


Is null == null c#?

558


What is default value of decimal c#?

552


What is clr namespace?

567


Does c# support templates?

636


What are jump statements in c#?

582


What are the delegates in c#?

567


What does the parsefloat function do?

569


Can an array be null c#?

593