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

How many bytes is a char c#?

481


What is the output of TextWriterTraceListener redirected?

541


Can we declare class as protected?

533


What is difference between the "throw" and "throw ex" in .net?

486


What is sorted list in c#?

504






What is dataview c#?

463


What is the difference between do and while loop?

442


Why do I get a security exception when I try to run my c# app?

540


Please explain value types and reference types used in c#?

470


What is the Signification of the "new " keyword in C#? example

508


List the 5 different access modifiers in c#?

506


What are the two kinds of properties in c#.

523


What is using in c#?

465


What is the use of oops in c#?

502


What is a console in c#?

482