What You Will Learn in This Chapter
- Converting values from one data type to another
- Widening, narrowing, implicit, and explicit conversions
- 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.
|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 ...|