I define an interface and build a class inherit it.
interface IOperator
{
int Priority{ get; }
string Identifier { get; }
int Dimension { get; }
Expression GetExpression(IVariable[] variables);
object Excute(IVariable[] variables);
}
public class Op_Muti:IOperator
{
int IOperator.Priority { get { return 40; } }
string IOperator.Identifier { get { return "*"; } }
int IOperator.Dimension { get { return 2; } }
public object IOperator.Excute(IVariable[] variables)
{
throw new ArgumentOutOfRangeException(string.Format("{0} can't apply to {1}", Identifier, variables[0].VarType.ToString()));
}
}
The Identifier is defined in interface
string Identifier { get; }
and implement in class Op_Muti
string IOperator.Identifier { get { return "*"; } }
but can't reference in
throw new ArgumentOutOfRangeException(string.Format("{0} can't apply to {1}", Identifier, variables[0].VarType.ToString()));
Why?