SectionInformation.AllowLocation Propriedade
Definição
Importante
Algumas informações dizem respeito a um produto pré-lançado que pode ser substancialmente modificado antes de ser lançado. A Microsoft não faz garantias, de forma expressa ou implícita, em relação à informação aqui apresentada.
Recebe ou define um valor que indica se a secção de configuração permite o location atributo.
public:
property bool AllowLocation { bool get(); void set(bool value); };
public bool AllowLocation { get; set; }
member this.AllowLocation : bool with get, set
Public Property AllowLocation As Boolean
Valor de Propriedade
true se o location atributo for permitido; caso contrário, false. A predefinição é true.
Exceções
O valor selecionado entra em conflito com um valor já definido.
Exemplos
Os exemplos nesta secção mostram como obter o valor da AllowLocation propriedade após aceder à informação da secção relacionada no ficheiro de configuração.
O exemplo seguinte obtém o SectionInformation objeto.
// Get the current configuration file.
System.Configuration.Configuration config =
ConfigurationManager.OpenExeConfiguration(
ConfigurationUserLevel.None);
// Get the section.
UrlsSection section =
(UrlsSection)config.GetSection("MyUrls");
SectionInformation sInfo =
section.SectionInformation;
' Get the current configuration file.
Dim config _
As System.Configuration.Configuration = _
ConfigurationManager.OpenExeConfiguration( _
ConfigurationUserLevel.None)
' Get the section.
Dim section As UrlsSection = _
CType(config.GetSection("MyUrls"), UrlsSection)
Dim sInfo As SectionInformation = _
section.SectionInformation
O exemplo seguinte obtém o AllowLocation valor.
bool allowLocation =
sInfo.AllowLocation;
Console.WriteLine("Allow location: {0}",
allowLocation.ToString());
Dim allowLocation As Boolean = _
sInfo.AllowLocation
Console.WriteLine("Allow location: {0}", _
allowLocation.ToString())
Observações
Quando definida para false, a AllowLocation propriedade indica que a secção é acedida por leitores nativos de código. Portanto, o uso do location atributo não é permitido, porque os leitores de código nativo não suportam o conceito de location.