Parsing

Parsing is the reverse of formatting, in that it consists of producing numeric or date values from strings such as 23.456. As a result, the concepts of format specifier and format provider discussed in the section "Formatting Strings for Output" earlier in this chapter also apply to parsing. All the .NET Compact Framework numeric types have a static Parse method that will parse strings to .NET Compact Framework types. You can parse any string to a numeric value, provided that it was produced or could have been produced by a format specifier. The following is a simple example of parsing:

string myString = "23.456";
double myDouble = double.Parse(myString);
    // myDouble will take the value 23.456

Resolving Parsing Issues

When parsing a numeric ...

Get Microsoft® .NET Compact Framework (Core Reference) 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.