StringBuilder::Clear Method ()
.NET Framework (current version)
Removes all characters from the current StringBuilder instance.
Assembly: mscorlib (in mscorlib.dll)
Clear is a convenience method that is equivalent to setting the Length property of the current instance to 0 (zero).
Calling the Clear method does not modify the current instance's Capacity or MaxCapacity property.
The following example instantiates a StringBuilder object with a string, calls the Clear method, and then appends a new string.
Universal Windows Platform
Available since 8
.NET Framework
Available since 4.0
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 4.0
Windows Phone Silverlight
Available since 7.1
Windows Phone
Available since 8.1
Available since 8
.NET Framework
Available since 4.0
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 4.0
Windows Phone Silverlight
Available since 7.1
Windows Phone
Available since 8.1
Show: