CHAPTER 19
Strings
All strings in C# are instances of the System.String type in the Common Language Runtime. Because of this, there are many built-in operations available that work with strings. For example, the String class defines an indexer function that can be used to iterate over the characters of the string.
using System;class Test{ public static void Main() { string s = "Test String"; for (int index = 0; index < s.Length; index++) { Console.WriteLine("Char: {0}", s[index]); } }}
Operations
The string class is an example of an immutable type, which means that the characters contained in the string ...
Get A Programmer's Guide to C# 5.0, 4th 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.