C#10 has a nice addition of CallerArgumentExpressionAttribute, which we could use to print actual argument expression in error messages.
I can see two problems though:
- We need to add optional
string parameter to methods. But we already have overloads with message string parameter.
- We have methods with
params parameter. And we can't combine params and optional parameters in the same method.
Is there any way we could make use of this attribute?
C#10 has a nice addition of CallerArgumentExpressionAttribute, which we could use to print
actualargument expression in error messages.I can see two problems though:
stringparameter to methods. But we already have overloads withmessagestring parameter.paramsparameter. And we can't combineparamsand optional parameters in the same method.Is there any way we could make use of this attribute?