Other Conversion Mechanisms

Conversion is such an important concept that history has yielded many shapes and forms of conversion mechanisms. We briefly touch on those here, but refer to MSDN documentation for a more thorough discussion.

System.Convert: Your One-Stop Conversion Shop

The first version of the .NET Framework introduced a (static) Convert class in the System namespace to help out people with all sorts of conversions involving primitive types supported by the runtime and the framework. Although some of the methods on the class do have a corresponding method elsewhere, the overall intent of Convert is to bundle all sorts of conversions together.

Most methods start with To, followed by a primitive type name, such as Int32, Char,

Get C# 5.0 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.