G
Geoffrey
Hello,
Form my software, I create a class to manage configuration.
Configuration parameters are retrieved from wml file, ini file, registry,
....
For this, I have a constructor that create a dataset with all my parameters,
and I have a method "getParameter" that return a value of a parameter ...
This class can do other think like modify parameter, display a usable list,
....
When I have a lot of class on my project, I must use an instance of my
configuration class in each of the class that would use it.
So, I have lot of instance of the same class ...
In c#, it's not possible to declare a global instance of this class.
And want to have a constructor (so impossible to have statict method) to
retrieve all parameters.
I don't want to have a static method that allways read configuration files
to retrieve a parameter.
What is the best design to do that ?
Allways create new instance on each class ?
Thx
Form my software, I create a class to manage configuration.
Configuration parameters are retrieved from wml file, ini file, registry,
....
For this, I have a constructor that create a dataset with all my parameters,
and I have a method "getParameter" that return a value of a parameter ...
This class can do other think like modify parameter, display a usable list,
....
When I have a lot of class on my project, I must use an instance of my
configuration class in each of the class that would use it.
So, I have lot of instance of the same class ...
In c#, it's not possible to declare a global instance of this class.
And want to have a constructor (so impossible to have statict method) to
retrieve all parameters.
I don't want to have a static method that allways read configuration files
to retrieve a parameter.
What is the best design to do that ?
Allways create new instance on each class ?
Thx