Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Question on releasing object and setting to .NULL.
Message
 
 
À
14/05/2009 18:44:36
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
01399978
Message ID:
01400013
Vues:
62
Mark,

> Now my second question, is it necessary to set o.o1=.NULL. in my example anyway, since it's already null due to executing o.o1.release()? Seems there's no hanging reference in this case. Thanks again!

This really depends on your object design, if it requires a specific call to a method to allow it to clean up after itself or not. I typically never call Release(). I normally put cleanup code in Destroy() and just null out the reference and let it clean itself up on it's way out. Sometimes I'll call a special Destruct() or CleanUp() method if the object has more complex things to do or if it has to report back a success or failure in it's clean up.

I'd say 99.9% of my object use code follows this pattern:
ox = createobject( ... )
...
ox.DoSomething()
...
ox = .null.
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform