8.10. The Casting Operator
Chapter 7 notes that explicit conversions of a larger data type to a smaller data type require casting. Casting is done using the () operator. For example:
long a = 1000L; int b = (int) a;
Here, the casting operator is used to cast a long a to an int b.
Get .NET for Java Developers: Migrating to 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.