Click or drag to resize

ObjectExtensionAsT Method

Converts the given value to the given type using the default converter. The result provides access to the converted value if conversion succeeded and simplifies access to default values if conversion failed.

Namespace:  TB.ComponentModel
Assembly:  UniversalTypeConverter (in UniversalTypeConverter.dll) Version: 2.0.0
Syntax
C#
public static ConversionResult<T> As<T>(
	this Object value,
	CultureInfo culture = null
)

Parameters

value
Type: SystemObject
The value which is converted.
culture (Optional)
Type: System.GlobalizationCultureInfo
The culture to use. If not given or null, the DefaultCulture is used.

Type Parameters

T
The type to which the given value is converted.

Return Value

Type: ConversionResultT
The result of the conversion.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type Object. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also