Access Properties.Settings.Default from a class?

When I create a console application, I can right-click on a project in Visual Studio 2008 Pro. click Properties> Go To Settings, enter the Application Area option and then access it from the code, for example

Console.WriteLine(Properties.Settings.Default.MySetting.ToString());

When I do the same in a class project and try to assign a scope value to a variable, for example

this.mySettingVariable = Properties.Settings.Default.MySetting.ToString();

I get an error when creating that the "Property Name" does not exist in the current context. "

What am I doing wrong and how can I access Application Scoped properties for a class project?

+3
source share
4 answers

. EXE-.

, , . DLL .config , : app.exe.config. DLL app.config app.exe.config . . .

- . . , .xml .

+5

, 'usings'.

, .

0

, . Visual Studio Office DLL , .

0

.settings "" ?

0

Source: https://habr.com/ru/post/1769570/


All Articles