Strings and Characters

  • Adam Freeman


Strings are important in any programming language, and C# is no exception. In this chapter, we looked at the C# support for individual characters and for strings, which represent sequences of characters. We saw how to use literal values to define character and string values and how to perform operations on both types. We explored the range of class members and operators available to make working with strings easier and looked at the System.Text.StringBuilder class, which is a mutable companion to the read-only System.String class.

We finished the chapter by looking at the composite formatting feature, which allows strings to be composed by embedding format items in strings, which become placeholders for string representations of other objects. We saw how to format the built-in numeric types and how to create custom format components.


Prefix Padding 


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

Copyright information

© Adam Freeman 2010

Authors and Affiliations

  • Adam Freeman

There are no affiliations available

Personalised recommendations