Chapter 5
Understanding Reference Data Types
What you will learn in this chapter:
- Reference data types
- How reference data types differ from value data types
- How the Bucket Analogy can be applied to reference data types
- String variables
- Verbatim string literals
- DateTime variables
- Constructor methods
- Overloaded methods
- Method signatures
wrox.com code downloads for this chapter
You can find the wrox.com code downloads for this chapter at www.wrox.com/remtitle.cgi?isbn=9781118336922 on the Download Code tab. The code in the Chapter05 folder is individually named as shown in this chapter.
In Chapter 3, you learned about the different value data types that C# makes available for use in your programs. This chapter concentrates on the other major type of data in C#: reference data types. Object-oriented programming owes much of its popularity to the power that reference data types bring to the programming table. Reference types are fundamental to object-oriented programming, and you will use them a lot.
String Variables
You already know that data used in a computer program falls into two broad categories: numeric data and textual data. Chapter 3 presented the value types that are used to store numeric data in a program. String variables are used to store textual data.
Data entered by a user into a program's textbox object is textual data. However, if you want to manipulate the user's input, you must first convert the textual data to numeric data by using the data type's TryParse() method. ...
Get Beginning Object-Oriented Programming with C# 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.