語言

ProfilePropertySettingsCollection.Remove(String) 方法

定義

從集合中移除一個 ProfilePropertySettings 物件。

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

參數

name
String

一個要從集合中移除的物件名稱 ProfilePropertySettings 。

例外狀況

集合中沒有 ProfilePropertySettings 帶有指定金鑰的物件。

-或-

該元素已經被移除。

-或-

本合集為唯讀。

範例

下列程式代碼範例示範如何使用 Remove 方法。 此程式碼範例是本類別更大範例 ProfileSection 的一部分。

// Remove a PropertySettings from the group.
newPropGroup.PropertySettings.Remove("AvatarImage");
newPropGroup.PropertySettings.RemoveAt(0);
' Remove a PropertySettings from the group.
newPropGroup.PropertySettings.Remove("AvatarImage")
newPropGroup.PropertySettings.RemoveAt(0)

備註

此方法將元素插入 remove 設定檔中對應高階設定檔中定義的元素的適當區段。 如果該元素在目前設定檔的適當區段中被定義,該元素的條目會從設定檔中移除。 要移除的物件必須存在於集合中。

適用於

另請參閱