A very convenient way is to use Strong settings . You can access these variables everywhere in the project and change its values ββwithout recompiling.
You can use the Visual Studio editor to define settings (Project> Properties> Settings):

These variables will be added to the appropriate section in the Web.config or App.config file as follows:
<setting name="SomeStringVariable" serializeAs="String"> <value>SomeStringValue</value> </setting> <setting name="SomeBoolVariable" serializeAs="String"> <value>false</value> </setting> <setting name="SomeDoubleVariable" serializeAs="String"> <value>1.23</value> </setting>
You can use certain variables anywhere in your project in a simple way:
string myStringVariable = Settings.Default.SomeStringVariable; bool myBoolVarialbe = Settings.Default.SomeBoolVariable; double myDoubleVariable = Settings.Default.SomeDoubleVariable;
source share