I have define the constant on constant.cs file, Please find below code.
public const string MessageVryPhone = "xyz";
Now I have created the object on my controller and take the value in variable from constant.
static MessageDM messageDmObj = new MessageDM();
public string abc= messageDmObj.GetContextualMessage(Helper.Constants.MessageVryPhone);
While I put the abc in regular experssion ErrorMessage
I am getting
an object reference is required to access non-static field, method or property error.
[RegularExpression("^\\([1-9][0-9]{2}\\)[ ][0-9]{3}[ ][-][ ][0-9]{4}$", ErrorMessage = abc)]
How to resolve this issue?