AppSettingsExpressionBuilder.GetAppSetting Método
Definição
Retorna um valor da seção <appSettings> do arquivo Web.config.Returns a value from the <appSettings> section of the Web.config file.
Sobrecargas
| GetAppSetting(String) |
Retorna um valor da seção |
| GetAppSetting(String, Type, String) |
Retorna um valor da seção |
GetAppSetting(String)
Retorna um valor da seção <appSettings> do arquivo Web.config.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
Parâmetros
- key
- String
A chave para o valor a ser recuperado do arquivo de configuração.The key for the value to be retrieved from the configuration file.
Retornos
O Object associado à chave na seção <appSettings> do arquivo Web.config.The Object associated with the key in the <appSettings> section of the Web.config file.
Exceções
A chave não é encontrada em Web.config.The key is not found in Web.config.
Comentários
Esse método recupera o valor apropriado dos pares de chave/valor na <appSettings> seção do arquivo de Web.config.This method retrieves the appropriate value from the key/value pairs in the <appSettings> section of the Web.config file. Ele recupera o valor obtendo a AppSettings propriedade com a chave como o índice.It retrieves the value by getting the AppSettings property with the key as the index. O Object retornado é do tipo String .The Object returned is of the type String.
Confira também
Aplica-se a
GetAppSetting(String, Type, String)
Retorna um valor da seção <appSettings> do arquivo Web.config com o valor convertido em um tipo de destino.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
Parâmetros
- key
- String
A chave para um valor a ser recuperado do arquivo de configuração.The key for a value to be retrieved from the configuration file.
- targetType
- Type
O tipo de objeto que contém a entrada de propriedade.The type of the object that contains the property entry.
- propertyName
- String
O nome da propriedade à qual a expressão está associada.The name of the property to which the expression is bound.
Retornos
O Object associado à chave na seção <appSettings> do arquivo Web.config.The Object associated with the key in the <appSettings> section of the Web.config file.
Exceções
A chave não é encontrada em Web.config.The key is not found in Web.config.
- ou --or-
O valor retornado não pôde ser convertido.The return value could not be converted.
Comentários
Esse método recupera o valor apropriado dos pares de chave/valor na <appSettings> seção do arquivo de Web.config.This method retrieves the appropriate value from the key/value pairs in the <appSettings> section of the Web.config file. O valor é recuperado obtendo a AppSettings propriedade com a chave como o índice.The value is retrieved by getting the AppSettings property with the key as the index. O valor da cadeia de caracteres resultante é convertido em um novo tipo com base nos targetType propertyName parâmetros e.The resulting string value is converted to a new type based on the targetType and propertyName parameters.