All Pages All Books|
|
||||
|
Introducing C# Programming • Chapter 2 47
|
||||
|
|
||||
|
on. In effect, you can self-document your classes and methods for other programmers using source code documentation comments. The XML emitted can be converted into other formats, such as HTML, and then be published so that other programmers can learn the classes and methods available in your program.You can learn more about XML in Chapter 9.
|
||||
|
|
||||
|
Introducing Data Types
|
||||
|
|
||||
|
A programming language wouldn’t be able to do much if it didn’t have data to work with. C# supports two data types: value types and reference types. Value types are the typical primitive types available in most programming languages and are allocated on the stack. Reference types are typically class instances and are allocated on the heap. Both are discussed in further detail in the following sections.
Value Types
Value types encompass the data types you would traditionally encounter in nonobject-oriented programming languages. This includes numeric, strings, bytes, and Booleans.Value types in C# are implemented in the form of Structures and Enums.Value types are allocated on the stack and therefore have little overhead associated with them.
Primitive Data Types
Primitive data types include all value types except structures. The primitive data types are shown in Table 2.2.
Table 2.2 Primitive Data Types, Sizes, and Descriptions
|
||||
|
|
||||