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

Attempts to convert 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 bool TryConvert(
	this Object value,
	Type targetType,
	NumberStyles? numberStyles,
	CultureInfo cultureInfo,
	DateTimeStyles? dateTimeStyles,
	out Object targetValue
)

Parameters

value  Object
The object to convert.
targetType  Type
The target type.
numberStyles  NullableNumberStyles
The number styles.
cultureInfo  CultureInfo
Optional culture information to use during conversion.
dateTimeStyles  NullableDateTimeStyles
The style of data type.
targetValue  Object
The converted value if the conversion is successful, otherwise default.

Return Value

Boolean
True if the conversion is successful, otherwise false.

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