Data Types

Data handling is one of the most important tasks you'll perform in C#. Some data handling is rudimentary, as when you place a quoted string of text in your code, which is called a literal:

Console.WriteLine("Hello from C#.");

Numerical values can also be literals, as when we used 32 and 212 like this:

Console.WriteLine("The temperature is between {0} and {1}", 32, 212);

When it comes to manipulating your data under programmatic control, you have to go further than that. In general, C# data types fall into the following categories:

  • Value types

  • Reference types

  • Pointer types

We'll take a look at each of these categories in turn.

Value Types

When you copy value types, a copy is made of their values (hence the name). Value types are broken ...

Get Microsoft® Visual C#® .NET 2003 Kick Start 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.