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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.