Permalink
Fetching contributors…
Cannot retrieve contributors at this time
45 lines (38 sloc) 2.48 KB
title ms.date ms.technology dev_langs helpviewer_keywords ms.assetid author ms.author
How to: Write Characters to a String
03/30/2017
dotnet-standard
csharp
vb
data streams, writing characters to string
writing characters to strings
streams, writing characters to strings
I/O [.NET Framework], writing characters to strings
1222cbeb-0760-44bf-9888-914a2a37174b
mairaw
mairaw

How to: Write Characters to a String

The following code examples write characters synchronously and asynchronously from a character array into a string.

Example

The following example writes 5 characters synchronously from an array to a string.

[!code-csharpConceptual.StringBuilder#9] [!code-vbConceptual.StringBuilder#9]

Example

The next example reads all the characters asynchronously from a xref:System.Windows.Controls.TextBox control, and stores them in an array. It then asynchronously writes each letter or white space character on a separate line followed by a line break to a xref:System.Windows.Controls.TextBlock control.

[!code-csharpConceptual.StringReader#2] [!code-vbConceptual.StringReader#2]

See also