Easy way to handle a 'variable' number of user settings?

  • Thread starter Thread starter Terry
  • Start date Start date
T

Terry

I have an application where the user can configure the an area of the UI to
contain a variable number of 'plans', lets say 0 to 6 of them. Each 'plan'
has a description and a type amongst other things. I wish to maintain the
information (description and type) in the user settings object. Do I need to
'pre-define' all six or is there a way to get at settings through a variable
name?

TIA,
 
I have an application where the user can configure the an area of the UI to
contain a variable number of 'plans', lets say 0 to 6 of them.   Each 'plan'
has a description and a type amongst other things.   I wish to maintainthe
information (description and type) in the user settings object.  Do I need to
'pre-define' all six or is there a way to get at settings through a variable
name?

TIA,

I can't remember off hand if the user settings object stores the
values as a property or method, but either one can be retrieved by a
string name. All objects expose the method GetType(), which in turn
will supply you the type object and allow you to retrieve the
propertyInfo by name using GetProperty(...) and passing in the name
and scope to search.

If it were me however I would just write my own user settings class
that pulls the values out of my own Xml file. It just personal
preference, but "rolling your own" will probably be easier to test
than using reflection on the built in user settings.

Thanks,

Seth Rowe [MVP]
http://sethrowe.blogspot.com/
 
Back
Top