Chapter 5More about Variables

Wrox.com Code Downloads for this Chapter

You can find the wrox.com code downloads for this chapter at www.wrox.com/go/beginningvisualc#2015programming on the Download Code tab. The code is in the Chapter 5 download and individually named according to the names throughout the chapter.

Now that you've seen a bit more of the C# language, you can go back and tackle some of the more involved topics concerning variables.

The first subject you look at in this chapter is type conversion, whereby you convert values from one type into another. You've already seen a bit of this, but you look at it formally here. A grasp of this topic gives you a greater understanding of what happens when you mix types in expressions (intentionally or unintentionally), as well as tighter control over the way that data is manipulated. This helps you to streamline your code and avoid nasty surprises.

Then you'll look at a few more types of variables that you can use:

  • Enumerations — Variable types that have a user-defined discrete set of possible values that can be used in a human-readable way.
  • Structs — Composite variable types made up of a user-defined set of other variable types.
  • Arrays — Types that hold multiple variables of one type, allowing index access ...

Get Beginning C# 6.0 Programming with Visual Studio 2015 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.