C
C#2y ago
nemui

❔ Is there a way to override the DefaultInterpolatedStringHandler?

So that just writing $"Something" immediately uses another handler.
4 Replies
Angius
Angius2y ago
https://btburnett.com/csharp/2021/12/17/string-interpolation-trickery-and-magic-with-csharp-10-and-net-6 You can have custom handlers You can't overwrite the default, far as I know It'd be a nightmare and a half if you could
nemui
nemui2y ago
Ye, but that's kind of what I was hoping for. I already made my own handler, just need a way to enforce it without being too intrusive.
333fred
333fred2y ago
If you overload your methods, it will prefer the overloads typed as handlers over ones typed as string But you can't make var s = $"{...}" be typed as your own handler type
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.