Share via


FormsAuthenticationUserCollection.Clear 方法

定义

从集合中删除所有 FormsAuthenticationUser 对象。

public:
 void Clear();
public void Clear ();
member this.Clear : unit -> unit
Public Sub Clear ()

例外

该集合是只读的。

示例

下面的代码示例说明如何使用 Clear 方法。

// Using method Clear.
formsAuthenticationCredentials.Users.Clear();
// Update if not locked
if (!authenticationSection.SectionInformation.IsLocked)
{
    configuration.Save();
}
' Using method Clear.
formsAuthenticationCredentials.Users.Clear()
' Update if not locked
If Not authenticationSection.SectionInformation.IsLocked Then
   configuration.Save()
End If

注解

此方法将 clear 指令插入配置文件的相应部分,以清除对更高级别配置文件中定义的元素的所有引用。 将删除在当前配置文件的相应部分中定义的所有元素。

适用于