Chapter 4
Using Types
What You Will Learn in This Chapter
- Converting values from one data type to another
- Widening, narrowing, implicit, and explicit conversions
- Casting
- Converting values with help methods and classes
- Manipulating strings
- Formatting values
WROX.COM CODE DOWNLOADS FOR THIS CHAPTER
You can find the code downloads for this chapter at www.wrox.com/remtitle.cgi?isbn=1118612094 on the Download Code tab. The code is in the chapter 04 download and individually named according to the names throughout the chapter.
Chapter 3, “Working with the Type System,” introduces the C# type system. It explains how to create value types (data structures and enumerations) and reference types (classes). It also explains encapsulation, and generic types and methods. This chapter continues the discussion of types by explaining how to convert between different types, such as converting an int or float into a string for display to the user. It explains how to use types to interact with unmanaged code. It also explains how to manipulate strings to perform such operations as determining whether a string begins with a given prefix and extracting substrings.
Table 4-1 introduces you to the exam objectives covered in this chapter.
Objective | Content Covered |
Create and Use Types | Create types. This includes boxing and unboxing value types, converting and casting between value types, handling dynamic types, and ensuring interoperability ... |
Get MCSD Certification Toolkit (Exam 70-483): Programming in 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.