Rediģēt

Kopīgot, izmantojot


How To: Read Settings at Run Time With C#

You can read both Application-scoped and User-scoped settings at run time via the Properties object. The Properties object exposes all of the default settings for the project via the Properties.Settings.Default member in the default namespace of the project they are defined in.

To Read Settings at Run Time with C#

Access the appropriate setting via the Properties.Settings.Default member. The following example shows how to assign a setting named myColor to a BackColor property. It requires you to have previously created a Settings file containing a setting named myColor of type System.Drawing.Color. For information about creating a Settings file, see How To: Create a New Setting at Design Time.

this.BackColor = Properties.Settings.Default.myColor;  

See also