Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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

Answer Posted / kishoreg

This is not a good and safe practice to call a Dispose.
In "Dot Net" it is automatically handle by Garbage
collection. It is the responsibility of GC to call the
Dispose and clear the memory.. but it is not sure that when
GC will call the Dispose.

so in that case we can forcefuly call it.

Consider one case when we forcefully destroy the object and
after some time i will try to use the same object at that
time u will get the error msg.

so better to object = null;

other material:
http://blogs.msdn.com/irenak/archive/2006/10/05/SYSK-
212_3A00_--Does-.NET-Garbage-Collector-call-Dispose_3F00_--
Dispose-_1320_-Best-Practices_2E00_.aspx

Is This Answer Correct ?    4 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why do we use struct in c#?

963


Why to use “finally” block in c#?

1097


Is it not possible to store a boolean value as a variable?

857


What is the use of readkey in c#?

983


What is difference between var dynamic and object in c#?

940


What is a reference type c#?

953


What are c# types?

1054


What is the difference between first and firstordefault?

909


Can I define a type that is an alias of another type (like typedef in c++)?

978


What are the Configuration files in .net?

954


How do I join one form to another in c#?

924


What are the access modifiers in c#?

938


What is class sortedlist underneath?

946


What is public void in c#?

999


Write the syntax for catching an exception in c#?

883