Types

Two kinds of types are supported in C#, value types and reference types. The difference between these two kinds of types is in the way the variables of each type behave.

Value Types

Unlike reference types, variables of value types contain the actual data they represent. Value types consist of predefined types, enums, and structs.

Predefined Types

Predefined types are shorthand for system types found in the .NET platform. Table D.3 outlines each of the value types found in C# as well as the system-provided type to which it corresponds.

Table D.3. Predefined Value Types in C#
Type Name Category Description
object System.Object The absolute base class of all other types
string System.String Unicode character sequence
sbyte System.SByte 8-bit ...

Get ASP.NET by Example 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.