c# - How to use app settings with class libraries on winforms? -
if create app.config main app, can use using:
string test = properties.settings.default.libtest;
where on app.config can find:
<applicationsettings> <rmanager.properties.settings> <setting name="libtest" serializeas="string"> <value>ola lib</value> </setting> </rmanager.properties.settings>
the question is, if have class library, there way access same setting using:
string libstring = properties.settings.default.libtest;
if not, solution best access settings main app?
i'd it's not correct if libruary can property main app. i'd suggest folowing:
create static class (f.e. settingsmanager) in libruary (or in common lib), , after application started fill data appconfig common static class (settingsmanager). , class(settingsmanager) property can use in app , in dll.
if dll , app has lot of bindings, should consider taking source dll exe app, in case able access app.config settings.
Comments
Post a Comment