Hi everyone,
I've a Configuration class with almost 200 read only properties.
This class makes available configuration data to my whole application.
I would like to group realted properties together.
The idea is to access the properties this way
configuration.D atabase.Server. IPAddress
instead of
configuration.D atabase_Server_ IPAddress
The above is only a sample but should get you the idea.
At first glance I should create other classes (in the example above I would
need at least the Database and Server classes) and nest them inside my
Configuration class.
But this approach requires a lot of work.
1. I have to create dozen of classes
2. It's difficult to make the classes read-only: they would be read only
also for the container class!
3. The point 2 above can be addresses at construction time: I could create
constructors which setup the read only properties, but again it's a lot of
work to do. If my nested properties has a 2 level depth, I should assign the
values at least 3 times (and that's 600 assignments for 200 properties!)...
Any idea?
Kind regards,
Corrado