To 'cast' or not to cast?
Type-conversion or type-casting, is a performance improvement utility. Cast or casting, per se, here in this context, refers to an action or task, indicating a deliberate type conversion, from one type to another.
Casting, operations, scenarios and collections are possible and important. Changing an entity of one data type into another is possible with and through cast/casting. This makes features and hierarchies work better and more to desired outcome and performance optimization. This makes compact storage possible, retrieval and enabling operations easier and faster, with accuracy and reliability. It is a programming simplifier and enabler of sorts. There are two types of casting or conversion: implicit and explicit. Casting is explicit and there are different types of explicit/casting, which include: checked, unchecked or bit pattern.
There are rules and restrictions in programming languages directing these conversions that need to be adhered to. For example: type errors can not be detected when casting to and from the Object class. It requires boxing and un-boxing (see elsewhere). These types of actions, typically slows time, processors and performance, so can be quite taxing on systems and networks, to be used with care. Casting is faster than generics, but generics are more often used, safer, less errors. There are different methods used for explicit conversion methods.
Key Exam Points
- Uses, applications, scenarios and solutions where cast is best used, how and why, the implications of the utility and tool - review the relevant chapters, content and references in detail, (both theory/paramaters and applications).
- For the exam, practical and hands-on study examples for cast/casting, that can help you to gain a better understanding of this topic would be well advised
- Take the Practice Exam, work-lab exercises, Q&A (with answers and solutions).
Related Terms
Type Conversion, Generics, Boxing, Unboxing.
This article is based on the 2nd edition of the Microsoft .Net Framework Application Training Kit with the purpose to help 70-536 Exam takers to succeed. I constantly look for ways to improve the content. Please leave a comment about this article or drop me a message if you would like to see changes for this site.





