List of properties/public variables

nbogdanovic

Member
Joined
Sep 26, 2006
Messages
5
Location
Washington, DC
Programming Experience
3-5
Hi,

I am trying to create an object that will have many (300 or so) properties/ public variables (which one should I really use?), based on their names I would retrieve a value from a database.

So lets say I have a class:

Public Class pref
Public userPref1 as String = ""
Public userPref2 as Boolean = False
End Class

now I would like to create a load() function that will go to a database and look up userPref1, assign it a value and then do the same thing for the userPref2.

How could I read these public vars into an array so I can apply the same look-up code to every element?

Thanks.
 
*shudders at the thought of 300 member variables to store some prefs

I have an app with a varying number of preferences stored in a database. I load them all into a DataTable that I perform lookups on using the Select() method

Additinally you can use a Dictionary or Hashtable object


I forsee no need to have an object of 300 properties unless youre trying to ensure the design-time regularity of usage of the class?
 
Thanks

Thank you very much for your reply. After thinking about this issue I came up with a similar conclusion.

I was converting a pretty old code from a Visual FoxPro windows application to VB.NET web app, and I just looked at the original code and that is how they did it, so I was led in the wrong direction.

Thanks.
 
Back
Top