ConfigurationLockCollection.Add(String) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
透過將配置物件加入集合來鎖定它。
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 集合會指定該組態物件被鎖定,且在從集合中移除前無法修改。