ObjectExtensionConvert(Object, Type, NullableNumberStyles, CultureInfo, NullableDateTimeStyles) Method

Converts an object to a specified type.

Definition

Namespace: FileHold.LibraryManager.Extensions
Assembly: FileHold.LibraryManager (in FileHold.LibraryManager.dll) Version: 17.2.0.0
C#
public static Object Convert(
	this Object value,
	Type targetType,
	NumberStyles? numberStyles = null,
	CultureInfo cultureInfo = null,
	DateTimeStyles? dateTimeStyles = null
)

Parameters

value  Object
The object to convert.
targetType  Type
targeted type
numberStyles  NullableNumberStyles  (Optional)
The number styles.
cultureInfo  CultureInfo  (Optional)
The culture information to use for formatting.
dateTimeStyles  NullableDateTimeStyles  (Optional)
The style of data type.

Return Value

Object
The converted value of the specified type, or null if the conversion fails.

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).

Exceptions

ExceptionThrown when the conversion cannot be performed.

See Also