Data Types, Casting, and Parsing
We learned in Chapter 6 that we can declare variables with a data type and then assign values to them in our code. We learned that we can accept user input and assign the input value to a variable, and we saw that there are times when we will need to convert a variable from one data type to another. In this context we learned about narrowing and widening conversions, and we used a conversion from an int to a byte, which involved casting, for example, (byte).
In C#, casting is a method used to convert one data ...