This documentation is archived and is not being maintained.

StringWriter.GetStringBuilder Method

Returns the underlying StringBuilder.

[Visual Basic]
Public Overridable Function GetStringBuilder() As StringBuilder
[C#]
public virtual StringBuilder GetStringBuilder();
[C++]
public: virtual StringBuilder* GetStringBuilder();
[JScript]
public function GetStringBuilder() : StringBuilder;

Return Value

The underlying StringBuilder.

Remarks

This is either the StringBuilder that was passed to the constructor, or the StringBuilder that was automatically created.

The following table lists examples of other typical or related I/O tasks.

To do this... See the example in this topic...
Create a text file. Writing Text to a File
Write to a text file. Writing Text to a File
Read from a text file. Reading Text from a File

Example

[Visual Basic, C#, C++] This code example is part of a larger example provided for the System.IO.StringWriter.StringWriter constructor.

[Visual Basic] 
' Use the underlying StringBuilder for more complex 
' manipulations of the string.
strWriter.GetStringBuilder().Insert(0, "Invalid ")

[C#] 
// Use the underlying StringBuilder for more complex 
// manipulations of the string.
strWriter.GetStringBuilder().Insert(0, "Invalid ");

[C++] 
// Use the underlying StringBuilder for more complex 
// manipulations of the string.
strWriter->GetStringBuilder()->Insert(0, S"Invalid ");

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework, Common Language Infrastructure (CLI) Standard

See Also

StringWriter Class | StringWriter Members | System.IO Namespace | Working with I/O | Reading Text from a File | Writing Text to a File

Show: