Jay Johengen
Altamahaw-Ossipee, Caroline du Nord, États-Unis
Information générale
Catégorie:
Gestionnaire d'écran & Écrans
Versions des environnements
>>While the other advice you've been given is correct, unless there's a good reason, I'd add the property in the Form Designer and just assign it in Init.
>>
>>Tamar
>
>What would drive the decision to do it one way or another?
If the property is always or almost always needed, it's better design to put in the class than to create it in an instance.
Sometimes, you have a class that you can't or aren't allowed to change (like from a library of some sort), so you have to add properties at runtime.
Also, there are some kinds of things you want to do that are better handled by runtime additions. For example, generic code to handle resizing often adds properties to hold onto some base values. The advantage of doing it that way is that the specific objects don't have to know anything about the generic code.
Tamar
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement