ConfigurationLockCollection.SetFromList(String) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Locks a set of configuration objects based on the supplied list.
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
A comma-delimited string.
Exceptions
Occurs when an item in the attributeList
parameter is not a valid lockable configuration attribute.
Examples
The following code example demonstrates how to use the SetFromList method. This code example is part of a larger example provided for the ConfigurationLockCollection class.
// 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)
Applies to
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈