SectionInformation.AllowLocation Propiedad

Definición

Obtiene o establece un valor que indica si la sección de configuración permite el atributo location.

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

Es true si se permite el atributo location; de lo contrario, es false. De manera predeterminada, es true.

Excepciones

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

Ejemplos

Los ejemplos de esta sección muestran cómo obtener el valor de propiedad AllowLocation después de tener acceso 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 en false, 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