O'Reilly logo

C# Primer: A Practical Approach by Stanley B. Lippman

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

5.1. Supporting the Fundamental Types

On its simplest level, the System namespace provides support for the fundamental data types of the language. In C#, all the primitive types, such as int, double, bool, and string, are aliases for types provided within the System namespace. These aliases are listed in Table 1.3 in Section 1.18.2.

The methods associated with these types can be invoked through objects of the aliased C# types. For example, to discover the range of values supported by one of the numeric types, we can access the MaxValue and MinValue properties:

int imaxval = int.MaxValue;
int iminval = int.MinValue;

One useful member function of each numeric type is Parse(). For example, given the string object

 string bonus = "$ 12,000.79"; ...

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