When dumping a string, the static ToDump method will not be called. I don't know why.
Here is my code: https://share.linqpad.net/o4a9v9rk.linq
This is not supported for strings. To make it work usefully with strings is likely to require more context being sent to the ToDump method. Do you have a use-case?
Yes, I have a use case for "string".
When I get a JSON string from an API call, I want to dump as a syntax highlighted version. I want to write this logic in the ToDump method so that I don't have to write another extension method something like DumpJson() or something.
In this case, how would be sure that the string is JSON? Would you need some further context in the ToDump method?
In this case, I will check the string format by using Regex or something in the ToDump method.