ConverterService class¶
Attributes: [DebuggerDisplay("{TypedConverters}, {FallbackConverters}")]
Defined in
Namespace: ReactiveUI
Assembly: ReactiveUI.Core.dll
Full name: ReactiveUI.ConverterService
Modifiers: public sealed
Summary¶
Provides unified access to all converter registries in ReactiveUI.
Applies to
net10.0, net10.0-maccatalyst26.0, net10.0-desktop1.0, net10.0-browserwasm1.0, net10.0-tvos26.0, net10.0-windows10.0.19041, net10.0-macos26.0, net10.0-ios26.0, net10.0-android36.0, net9.0, net9.0-tvos18.0, net9.0-macos15.0, net9.0-maccatalyst18.0, net9.0-windows10.0.19041, net9.0-ios18.0, net9.0-desktop1.0, net8.0, net8.0-windows10.0.19041, net8.0-ios18.0, net8.0-maccatalyst18.0, net8.0-macos15.0, net8.0-tvos18.0, net8.0-ios17.5, net8.0-maccatalyst17.5, net8.0-macos14.5, netstandard2.1, net481, net462, net471
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.
Affinity Guidelines:
- 0: Converter cannot handle the type pair
- 1: Last resort (e.g., EqualityTypeConverter)
- 2: Standard ReactiveUI converters (string, numeric, datetime)
- 8: Platform-specific standard converters (NSDate, WinForms controls)
- 100+: Third-party override range (use to override ReactiveUI defaults)
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. |