Chapter 15. Performing Conversions
In This Chapter
Implicit Versus Explicit Conversions
Value Type Conversions
Reference Type Conversions
Conversion refers to the capability to change an object from one type to another. This is a runtime versus compile-time feature. Conversions can be explicit or implicit; implicit conversions occur when automatic conversion is possible, and explicit conversions are invoked when there is a possibility of error or data loss.
C# has built-in conversions for the primitive data types. Programmers can also create their own conversions when designing a new class. This provides the capability to convert to and from a user-defined type and another user-defined or primitive type.
Get C# Unleashed 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.