SecureString.Clear Method ()


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Deletes the value of the current secure string.

Namespace:   System.Security
Assembly:  mscorlib (in mscorlib.dll)

member Clear : unit -> unit

Exception Condition

This secure string has already been disposed.


This secure string is read-only.

The computer memory that contains the value of this secure string is zeroed, then the length of the value of this secure string is set to zero.

The following example demonstrates how the AppendChar, InsertAt, RemoveAt, SetAt, and Clear methods affect the value of a SecureString object.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 2.0
Return to top