Επεξεργασία

Κοινή χρήση μέσω


AppSettingsExpressionBuilder.GetAppSetting Method

Definition

Returns a value from the <appSettings> section of the Web.config file.

Overloads

GetAppSetting(String)

Returns a value from the <appSettings> section of the Web.config file.

GetAppSetting(String, Type, String)

Returns a value from the <appSettings> section of the Web.config file with the value converted to a target type.

GetAppSetting(String)

Returns a value from the <appSettings> section of the Web.config file.

public:
 static System::Object ^ GetAppSetting(System::String ^ key);
public static object GetAppSetting (string key);
static member GetAppSetting : string -> obj
Public Shared Function GetAppSetting (key As String) As Object

Parameters

key
String

The key for the value to be retrieved from the configuration file.

Returns

The Object associated with the key in the <appSettings> section of the Web.config file.

Exceptions

The key is not found in Web.config.

Remarks

This method retrieves the appropriate value from the key/value pairs in the <appSettings> section of the Web.config file. It retrieves the value by getting the AppSettings property with the key as the index. The Object returned is of the type String.

See also

Applies to

GetAppSetting(String, Type, String)

Returns a value from the <appSettings> section of the Web.config file with the value converted to a target type.

public:
 static System::Object ^ GetAppSetting(System::String ^ key, Type ^ targetType, System::String ^ propertyName);
public static object GetAppSetting (string key, Type targetType, string propertyName);
static member GetAppSetting : string * Type * string -> obj
Public Shared Function GetAppSetting (key As String, targetType As Type, propertyName As String) As Object

Parameters

key
String

The key for a value to be retrieved from the configuration file.

targetType
Type

The type of the object that contains the property entry.

propertyName
String

The name of the property to which the expression is bound.

Returns

The Object associated with the key in the <appSettings> section of the Web.config file.

Exceptions

The key is not found in Web.config.

-or-

The return value could not be converted.

Remarks

This method retrieves the appropriate value from the key/value pairs in the <appSettings> section of the Web.config file. The value is retrieved by getting the AppSettings property with the key as the index. The resulting string value is converted to a new type based on the targetType and propertyName parameters.

See also

Applies to