Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Using IDisposable
Message
De
21/11/2008 17:03:01
 
 
À
21/11/2008 16:47:31
Timothy Bryan
Sharpline Consultants
Conroe, Texas, États-Unis
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
C# 3.0
OS:
Windows XP SP2
Application:
Desktop
Divers
Thread ID:
01363570
Message ID:
01363582
Vues:
10
Yikes. This doesn't sound good. What are you doing that you need major garbage collection? Do you have a link for this quote?

>I don't know Craig, I am having one of those days when I don't know what is right anymore. I just finished reading an article by a respected source that says and I quote
>"The most important point to remember if you supply a destructor is that you cannot predict when it will be called - it will only be executed when the garbage collector runs and removes it from memory. It is for this reason that if you have any expensive unmanaged resources to release when your class is destroyed, it is preferable to dispose of them in a Close() or Dispose() method that can be called explicitly by the user of the class. In actual fact, we can never guarantee that a destructor will ever be called since we can tell the garbage collector NOT to call an object's destructor with the SuppressFinalize method of the System.GC class.
>Does this insure my method would be called?
Craig Berntson
MCSD, Microsoft .Net MVP, Grape City Community Influencer
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform