Chapter 14. Chars, Strings, and Working with Text

In this chapter:

Characters

The System.String Type

Constructing a String Efficiently

Obtaining a String Representation of an Object: ToString

Parsing a String to Obtain an Object: Parse

Encodings: Converting Between Characters and Bytes

Secure Strings

In this chapter, I’ll explain the mechanics of working with individual characters and strings in the Microsoft .NET Framework. I’ll start by talking about the System.Char structure and the various ways that you can manipulate a character. Then I’ll go over the more useful System.String class, which allows you to work with immutable strings. (Once created, strings can’t be modified in any way.) After examining strings, I’ll show you how to perform various ...

Get CLR via C#, Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.