Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Set and Get appl obj property good practice
Message
 
 
À
31/07/2009 08:49:18
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 9 SP1
Divers
Thread ID:
01415630
Message ID:
01415634
Vues:
67
>>Hi,
>>
>>I need to add about 10 (max) propertied to the application object. These properties will hold names of various meta tables of the application. Then, in many places of the application, this values will be retrieved and used. I know of two approaches
>>
>>1. Create a separate property for each one of the meta names (e.g. "MyMetaTbl1", "MyMetaTbl2", etc.). Then I would have to have as many Get methods in the application object to retrieve these values (e.g. method GetMyMetaTbl1, method GetMyMetaTbl2, etc.
>>
>>2. Create an array property for the application object with number of elements corresponding to the number of meta table names I need to store. Then I can have just one method of getting the values (e.g. GetMetaTableName(nEle))
>>
>>I am leaning toward the approach 2 but want to be sure that I am not going to miss something
>>
>>What is a better practices?
>
>I think I'd use a collection rather than an array and then the key to the collection can be whatever you need to use to look up the right item.
>
>Tamar

After getting your message and reading on Collection class in VFP help I understand this approach better. Thank you for your suggestion.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform