How To: Read Settings at Run Time With C#

.NET Framework (current version)

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.

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.

    // C#
    this.BackColor = Properties.Settings.Default.myColor;