ConverterService class¶
Defined in
Namespace: ReactiveUI.Binding
Assembly: ReactiveUI.Binding.dll
Full name: ReactiveUI.Binding.ConverterService
Modifiers: public sealed
Summary¶
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¶
| Name | Summary |
|---|---|
| .ctor | Initializes a new instance of the [ConverterService](# class. |
Properties¶
| Name | Summary |
|---|---|
| TypedConverters | Gets the registry for typed binding converters. |
| FallbackConverters | Gets the registry for fallback binding converters. |
| SetMethodConverters | Gets the registry for set-method binding converters. |
Methods¶
| Name | Summary |
|---|---|
| ResolveConverter | Resolves the best converter for the specified type pair. |
| ResolveSetMethodConverter | Resolves the best set-method converter for the specified type pair. |