Chapter 2. Understanding Data Types
In This Chapter
Declaring variables
Seeing the differences between value types and reference types
Understanding how data types are used in the .NET Framework
Handling more than one variable
Finding data types and using them in your code
The data type you specify for the variable declaration determines everything about how that variable is treated throughout its entire life cycle. This chapter shows the data types available in the .NET Framework and how to create your own data types.
The Rules of Data Types
Data types are the fundamental organizing blocks of code in .NET. Your program can do very little without using data types. If you've never programmed with .NET, you might be thinking of data types in terms of integers and characters. Those are one kind of data type, but other data types are more flexible, sophisticated, and powerful than integers and characters. Examples include classes, structures, and enumerations.
Variables are used to access data that you place in your computer's memory. When you declare a variable, you specify its data type. This is how your computer program knows how to assign meaning to the ones and zeroes that you store in your computer's memory.
From the perspective of the computer, all data is just a set of ones and zeroes. Computer programs apply meaning to those ones and zeroes by using data types. A data type tells your computer how your program can interact with the data and what operations are legal.
Examples of data types ...
Get Visual Studio® 2010 All-in-One For Dummies® 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.