站内搜索: 请输入搜索关键词
当前页面: 图书首页 > NET For Java Developers Migrating To C#

NET For Java Developers Migrating To C#

[ directory ] Previous Section Next Section

Chapter 7. Data Types

Data types constitute the building blocks of any programming language. This chapter discusses the basic C# data types in detail and compares them to Java data types.

Recall that both C# and Java are strongly typed languages, meaning that all the variable declarations should identify the data type of the variable. C# has three data types: value types, reference types, and pointer types. Value types store data, whereas reference types store references to the actual data, and the pointer types can be used only in unsafe mode (more about unsafe mode later in the chapter). In Java, there is a similar demarcation between the data types; the value types are referred to as primitives, and reference types are references to arrays, classes, or interfaces. There is no unsafe mode of operation in Java, and hence there is no pointer type.

We will briefly introduce the two data types for both languages and then discuss the C# data types in detail.

    [ directory ] Previous Section Next Section