Skip to content

ConverterService class

Defined in

Namespace: ReactiveUI.Binding Assembly: ReactiveUI.Binding.dll Full name: ReactiveUI.Binding.ConverterService Modifiers: public sealed

Summary

View source

        Provides unified access to all converter registries in ReactiveUI.Binding.
        

Applies to

net10.0, net10.0-browserwasm1.0, net10.0-desktop1.0, net9.0, net9.0-browserwasm1.0, net9.0-desktop1.0, net8.0, net8.0-ios17.5, net8.0-maccatalyst17.5, net8.0-macos14.2, net8.0-macos14.5, net8.0-tvos17.2, netstandard2.1, net462, net481

Remarks

This service manages three types of converters:

-

Typed Converters: Exact type-pair converters (e.g., int -> string). Registered via TypedConverters and selected based on affinity for exact matches.

-

Fallback Converters: Runtime type converters using reflection or type descriptors. Registered via FallbackConverters and consulted when no typed converter matches.

-

Set-Method Converters: Specialized converters for binding set operations. Registered via SetMethodConverters for platform-specific control binding.

Converter Selection Algorithm:

  • 1.

Phase 1: Search for exact type-pair match in TypedConverters. If found, return the typed converter with the highest affinity.

  • 2.

Phase 2: If no typed converter found, search FallbackConverters. Return the fallback converter with the highest affinity for the runtime types.

  • 3.

Result: If neither phase finds a converter, return null.

Constructors

NameSummary
.ctorInitializes a new instance of the [ConverterService](# class.

Properties

NameSummary
TypedConvertersGets the registry for typed binding converters.
FallbackConvertersGets the registry for fallback binding converters.
SetMethodConvertersGets the registry for set-method binding converters.

Methods

NameSummary
ResolveConverterResolves the best converter for the specified type pair.
ResolveSetMethodConverterResolves the best set-method converter for the specified type pair.
Inherited members

Extension members