Whenever I attempt to set the default value of an optional parameter to something in a resource file, I get a compile-time error of
Default parameter value for 'message' must be a compile-time constant.
Is there any way that I can change how the resource files work to make this possible?
public void ValidationError(string fieldName,
string message = ValidationMessages.ContactNotFound)
In this, ValidationMessages
is a resource file.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…