ConfigurationLockCollection.SetFromList(String) Methode
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 set configuratieobjecten vergrendeld op basis van de opgegeven lijst.
public:
void SetFromList(System::String ^ attributeList);
public void SetFromList(string attributeList);
member this.SetFromList : string -> unit
Public Sub SetFromList (attributeList As String)
Parameters
- attributeList
- String
Een door komma's gescheiden tekenreeks.
Uitzonderingen
Treedt op wanneer een item in de attributeList parameter geen geldig configuratiekenmerk is dat kan worden vergrendeld.
Voorbeelden
In het volgende codevoorbeeld ziet u hoe u de SetFromList methode gebruikt. Dit codevoorbeeld maakt deel uit van een groter voorbeeld voor de ConfigurationLockCollection klasse.
// Create an ArrayList to contain
// the property items of the configuration
// section.
ArrayList configPropertyAL = new ArrayList(lockedAttribList.Count);
foreach (PropertyInformation propertyItem in
configSection.ElementInformation.Properties)
{
configPropertyAL.Add(propertyItem.Name.ToString());
}
// Copy the elements of the ArrayList to a string array.
String[] myArr = (String[])configPropertyAL.ToArray(typeof(string));
// Create as a comma delimited list.
string propList = string.Join(",", myArr);
// Lock the items in the list.
lockedAttribList.SetFromList(propList);
' Create an ArrayList to contain
' the property items of the configuration
' section.
Dim configPropertyAL As ArrayList = _
New ArrayList(lockedAttribList.Count)
For Each propertyItem As _
PropertyInformation In _
configSection.ElementInformation.Properties
configPropertyAL.Add(propertyItem.Name.ToString())
Next
' Copy the elements of the ArrayList to a string array.
Dim myArr As [String]() = _
CType(configPropertyAL.ToArray(GetType(String)), [String]())
' Create as a comma delimited list.
Dim propList As String = String.Join(",", myArr)
' Lock the items in the list.
lockedAttribList.SetFromList(propList)