Properties property of Application class gets a collection of all
application-scope properties. Application property can be compared with
application state in ASP.NET where we can store any application level data in
application state that may be accessed from anywhere within that application.
In the code snippet in Listing 1, we add two data items to
Properties.
void
App_Startup(object sender, StartupEventArgs e)
{
this.Properties["Login"] = "mc";
this.Properties["Password"] = "pwd";
}
Listing 1
Once this data is added to Application.Properties, it is
available from anywhere within that application.
The code snippet in Listing 2 access
the above added data on a form load.
string
uid = Application.Current.Properties["Login"].ToString();
string pwd = Application.Current.Properties["Password"].ToString();
Listing 2