How to Resolve a Complex Type as a String Implicitly
Along the same lines as resolving a complex type in a conditional, I also want to be able to take the same Authorization Result, and use it to broadcast a message to the system (or user), and tell them why couldn’t they be authorized.
An example of the behavior I’m looking for is something like this:
1 2 3
The Authorization Exception takes a String in it’s constructor, just like a typical Exception. It does not take an AuthorizationResult. So how am I able to just pass in an authorizationResult like that? Again, the implicit operator is all we need:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Now I can use AuthorizationResult implicitly as both a bool and a string.