Compartir por


SectionInformation.AllowLocation Propiedad

Definición

Obtiene o establece un valor que indica si la sección de configuración permite el 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 propiedad

true es si se permite el location atributo; en caso contrario, falsees . El valor predeterminado es true.

Excepciones

El valor seleccionado entra en conflicto con un valor que ya está definido.

Ejemplos

Los ejemplos de esta sección muestran cómo obtener el valor de la AllowLocation propiedad después de acceder a la información de sección relacionada en el archivo de configuración.

En el ejemplo siguiente se obtiene el 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

En el ejemplo siguiente se obtiene el 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())

Comentarios

Cuando se establece falseen , la AllowLocation propiedad indica que los lectores de código nativo acceden a la sección. Por lo tanto, no se permite el uso del location atributo porque los lectores de código nativo no admiten el concepto de location.

Se aplica a