// Get an application-scope property// NOTE: Need to convert since Application.Properties is a dictionary of System.Objectstring myApplicationScopeProperty = (string)Application.Current.Properties["MyApplicationScopeProperty"];
There are two considerations to make when using Properties. First, the dictionary key is an object, so you need to use exactly the same object instance when both setting and getting a property value (note that the key is case-sensitive when using a string key). Second, the dictionary value is an object, so you will need to convert the value to the desired type when getting a property value.
Because the dictionary value is an object, you can just as easily use custom types as simple types, like so:
// Get an application-scope property// NOTE: Need to convert since Application.Properties is a dictionary of System.Object
CustomType customType = (CustomType)Application.Current.Properties["CustomType"];