April 2002
Intermediate to advanced
1024 pages
23h 26m
English
This class converts one base type to another base type. All of the basic types are represented in each version, but that conversion might not actually occur. Three different cases exist:
No conversion takes place. An example of this is converting a type to itself.
If the conversion does not make sense, the Convert class method throws an exception (InvalidCastException, FormatException, OverflowException, and so on).
The Convert method succeeds in making the conversion.
Listing B.4 shows an example of a conversion from a string read in the Console to a DateTime structure (convert.cs).
public static void Main(String[] args) { Console.Write("Input a date: "); string input = Console.ReadLine(); try { ... |