
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
80
|
Chapter 2: Strings and Characters
return and line-feed characters to represent a newline; on a Unix system the newline
consists of only the line-feed character
\n. You do not need to worry about this, as
the
AppendLine method knows which newline character(s) to apply.
If you simply want to add several blank lines to your string, you can call
AppendLine
with no parameters. This effectively adds only a newline character to the current string
in the
StringBuilder object on which it was called. Calling this method with no
parameter can also be used to add a newline character(s) to the current line, if the cur-
rent line has no newline character(s). For example, the code in the Solution added a
string with no newline character(s) to the instantiated
StringBuilder object sb. You
can then call sb.AppendLine( ) to force a newline character to be appended to this text.
See Also
See the “StringBuilder.AppendLine Method” topic in the MSDN documentation.
2.26 Encoding Chunks of Data
Problem
You need to encode some data; however, you will be receiving it in blocks of a cer-
tain size, not all at once. Your encoder needs to be able to append each block of data
to the previous one to reconstitute the entire data stream.
Solution
Use the Convert method on the Encoder class. The following method,
ConvertBlocksOfData ...