Skip to content

RuntimeBindingConverter.TryConvert(TFrom, object?, IBindingTypeConverter?, TTo) method

Defined in

Type: RuntimeBindingConverter Namespace: ReactiveUI.Binding.Reactive.Fallback Assembly: ReactiveUI.Binding.Reactive.dll

Applies to

net10.0, net10.0-browserwasm1.0, net10.0-desktop1.0, net9.0, net9.0-tvos18.0, net9.0-maccatalyst18.0, net9.0-ios18.0, net9.0-macos15.0, net9.0-desktop1.0, net8.0, net8.0-macos14.5, net8.0-ios18.0, net8.0-maccatalyst18.0, net8.0-macos15.0, net8.0-tvos18.0, net8.0-ios17.5, net8.0-maccatalyst17.5, netstandard2.1, net481, net462, net471

public static bool TryConvert<TFrom, TTo>(TFrom value, object? conversionHint, IBindingTypeConverter? converterOverride, out TTo result)

View source

Summary: Attempts to convert value from TFrom to TTo for a generated BindTo assignment.

Type parameters

NameDescription
TFromThe declared source value type.
TToThe target property type.

Parameters

NameTypeDescription
valueTFromThe value produced by the source observable.
conversionHintobject?An optional conversion hint forwarded to the converter.
converterOverride[IBindingTypeConverter?](#An optional explicit converter that takes precedence over the registry.
out resultTToThe converted value when conversion succeeds.

Returns: bool -- true if conversion succeeded; otherwise false.

Remarks

The converter is resolved from the declared types rather than from the value's runtime type. A runtime Type cannot satisfy the annotations the converter registry declares, so resolving from one would put a trimming requirement on every generated binding that converts. The declared types are what the generator bound, so they are what the registry is asked about.