ReflectionUtils.StringToTypedValue

Turns a string into a typed value generically. Explicitly assigns common types and falls back on using type converters for unhandled types.

Common uses: * UI -> to data conversions * Parsers

public static object StringToTypedValue(string sourceString,
	Type targetType,
	CultureInfo culture)

Return Value

object. Throws exception if it cannot be converted.

Parameters

sourceString
The string to convert from

targetType
The type to convert to

culture
Culture used for numeric and datetime values.


See also:

Class ReflectionUtils

© West Wind Technologies, 1996-2016 • Updated: 12/12/15
Comment or report problem with topic