Click or drag to resize
DigitalRuneObjectHelperParse Method (Type, String)
Parses a string and converts it to the specified type (using the invariant culture).

Namespace: DigitalRune
Assembly: DigitalRune (in DigitalRune.dll) Version: 1.20.0.0 (1.20.1.14552)
Syntax
public static Object Parse(
	Type type,
	string value
)

Parameters

type
Type: SystemType
The target type.
value
Type: SystemString
The value.

Return Value

Type: Object
An instance of the given type that represents the string value.
Exceptions
ExceptionCondition
NotSupportedException Cannot convert string to target type.
ArgumentNullExceptiontype is .
Remarks

This method can parse values of types that

  • implement System.IConvertible,
  • have a static method Parse(string) or Parse(string, IFormatProvider), or
  • have a TypeConverter.

A NotSupportedException is thrown for other types that do not have an automatic mechanism for value conversion from string. Further, an exception can be thrown if the given string is invalid.

See Also