Skip to main content

TryConvert Method

Try to convert a value to a type by any means possible.

Definition​

Namespace: Avalonia.Utilities
Assembly: Avalonia.Base (in Avalonia.Base.dll)

public static bool TryConvert(
Type to,
Object? value,
CultureInfo? culture,
out Object?? result
)

Parameters​

  Type
The type to convert to.
  Object
The value to convert.
  CultureInfo
The culture to use.
  Object
If successful, contains the convert value.

Return Value​

Boolean
True if the cast was successful, otherwise false.

See Also​

Reference​

TypeUtilities Class
Avalonia.Utilities Namespace