O'Reilly logo

A Programmer's Guide to C# 5.0, 4th Edition by Nick Wienholt, Eric Gunnerson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

CHAPTER 19

image

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required