eldiener

The String.Format functions allows one to convert various object types to a string, the equivalent of sprintf in C or ostringstream in C++.

What is the function for converting a string to various object types, the equivalent to sscanf in C or istringstream in C++ .

I have found the System.Convert class, but while I can use various formatting characters in System.Format to control my conversion from an object type to a string, the System.Convert class does not have any equivalent formatting characters to control the interpretation of the string back to an object type.

For instance I can use X or x format string to format an integer to a string having hexidecimal format, but I can see no way using System.Convert to convert back from a hexidecimal string to an equivalen integer value.


Re: .NET Base Class Library Converting from string to objects

timvw

Most types that support this do it by exposing a Parse and a TryParse method...





Re: .NET Base Class Library Converting from string to objects

eldiener

timvw wrote:
Most types that support this do it by exposing a Parse and a TryParse method...


Thanks, I do see the System.Int32.Parse which takes an appropriate NumberStyles.