Proposal: Add a `TreatAsString` field to `QueryAttribute` by mark-pro · Pull Request #1943 · reactiveui/refit
The proposal arises from the need to pass custom types or structs which might represent types with rules and conversions.
For example:
```csharp
record readonly struct ZipCode(ushort ZipCode) {
public override string ToString() =>
ZipCode.ToString();
}
```
To solve the problem the proposal seeks to add a field to the QueryAttribute called `TreatAsString`.
The new field is used when the query string is created and simply calls the `ToString()` function on a type.
There is a workaround that is not documented. The current workaround is to implement `IFormattable` on the type, which feels redundant if `ToString()` is already implemented on a custom type.
github-actions
bot
locked as resolved and limited conversation to collaborators
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters