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, 2019 • Updated: 06/23/19
Comment or report problem with topic