ConfigurationLockCollection.Add(String) 方法

定義

藉由將組態物件加入集合中來鎖定它。

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

參數

name
String

組態物件的名稱。

例外狀況

發生在 name 不符合集合中現有的組態物件時。

範例

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

// Add an attribute to the lock collection.
if (!lockedAttribList.Contains("enabled"))
{
  lockedAttribList.Add("enabled");
}
' Add an attribute to the lock collection.
If Not (lockedAttribList.Contains("enabled")) Then
  lockedAttribList.Add("enabled")
End If

備註

將組態物件新增至 ConfigurationLockCollection 集合會指定設定物件已鎖定,而且在從集合中移除之前無法修改。

適用於