Free mag vol1 | Page 152

CHAPTER 3  CORE C# PROGRAMMING CONSTRUCTS, PART I } // You need to reference PresentationFramework.dll // in order to compile this line of code! System.Windows.MessageBox.Show(userMessage); System Data Types and Corresponding C# Keywords Like any programming language, C# defines keywords for fundamental data types, which are used to represent local variables, class data member variables, method return values, and parameters. Unlike other programming languages, however, these keywords are much more than simple compilerrecognized tokens. Rather, the C# data type keywords are actually shorthand notations for full-blown types in the System namespace. Table 3-4 lists each system data type, its range, the corresponding C# keyword, and the type’s compliance with the common language specification (CLS).  Note Recall from Chapter 1 that CLS-compliant .NET code can be used by any managed programming language. If you expose non–CLS-compliant data from your programs, other languages might not be able to make use of it. Table 3-4. The Intrinsic Data Types of C# 86 C# Shorthand CLS Compliant? System Type Range Meaning in Life bool Yes System.Boolean true or false Represents truth or falsity sbyte No System.SByte –128 to 127 Signed 8-bit number byte Yes System.Byte 0 to 255 Unsigned 8-bit number short Yes System.Int16 –32,768 to 32,767 Signed 16-bit number ushort No System.UInt16 0 to 65,535 Unsigned 16-bit number int Yes System.Int32 –2,147,483,648 to 2,147,483,647 Signed 32-bit number uint No System.UInt32 0 to 4,294,967,295 Unsigned 32-bit number long Yes System.Int64 –9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 Signed 64-bit number ulong No System.UInt64 0 to 18,446,744,073,709,551, 615 Unsigned 64-bit number