ProfileGroupSettingsCollection.Remove(String) 方法

定义

ProfileGroupSettings 集合中删除对象。

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

参数

name
String

要从集合中移除的对象的名称 ProfileGroupSettings

例外

ProfileGroupSettings集合中没有指定索引处的对象、元素已被移除或集合为只读。

示例

下面的代码示例演示如何使用 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> 到配置文件的相应节中,用于在较高级别的配置文件中定义的任何元素。 如果元素在当前配置文件的相应节中定义,则会从配置文件中删除其条目。 要删除的对象必须存在于集合中。

适用于

另请参阅