Commonly Used String Methods

Throughout this exploration of the framework’s rich functionality to deal with text, we have barely spoken about the type it’s all about: System.String. Let’s spend a minute or two pinpointing a few useful methods of this class.

Note: Strings Are Character Sequences

And because sequences are implemented using the IEnumerable<T> interface, guess what? The whole set of query operators defined over IEnumerable<T>, here with T substituted for char, shows up in the IntelliSense on a string object. This can be perceived as annoying at times. In fact, prior to Visual Studio 2010, for some reason I don’t understand, IntelliSense on string objects never showed the extension methods.

Obviously, this behavior can be suppressed ...

Get C# 5.0 Unleashed now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.