共用方式為


ConfigurationLockCollection.SetFromList(String) 方法

定義

根據提供的清單鎖定一組組態物件。

public:
 void SetFromList(System::String ^ attributeList);
public void SetFromList (string attributeList);
member this.SetFromList : string -> unit
Public Sub SetFromList (attributeList As String)

參數

attributeList
String

以逗號分隔的字串。

例外狀況

發生在 attributeList 參數中的項目不是有效的可鎖定組態屬性時。

範例

下列程式碼範例會示範如何使用 SetFromList 方法。 此程式代碼範例是提供給 類別之較大範例的 ConfigurationLockCollection 一部分。

// 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)

適用於