SectionInformation.AllowLocation Eigenschap
Definitie
Belangrijk
Bepaalde informatie heeft betrekking op een voorlopige productversie die aanzienlijk kan worden gewijzigd voordat deze wordt uitgebracht. Microsoft biedt geen enkele expliciete of impliciete garanties met betrekking tot de informatie die hier wordt verstrekt.
Hiermee wordt een waarde opgehaald of ingesteld die aangeeft of de configuratiesectie het location kenmerk toestaat.
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
Waarde van eigenschap
trueals het location kenmerk is toegestaan; anders. false De standaardwaarde is true.
Uitzonderingen
De geselecteerde waarde conflicteert met een waarde die al is gedefinieerd.
Voorbeelden
In de voorbeelden in deze sectie ziet u hoe u de AllowLocation eigenschapswaarde kunt ophalen nadat u de gerelateerde sectiegegevens in het configuratiebestand hebt geopend.
In het volgende voorbeeld wordt het SectionInformation object opgehaald.
// 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
In het volgende voorbeeld wordt de AllowLocation waarde opgehaald.
bool allowLocation =
sInfo.AllowLocation;
Console.WriteLine("Allow location: {0}",
allowLocation.ToString());
Dim allowLocation As Boolean = _
sInfo.AllowLocation
Console.WriteLine("Allow location: {0}", _
allowLocation.ToString())
Opmerkingen
Als deze is ingesteld falseop, geeft de AllowLocation eigenschap aan dat de sectie wordt geopend door systeemeigen codelezers. Daarom is het gebruik van het location kenmerk niet toegestaan, omdat de systeemeigen-codelezers het concept van location.