is there some ‘where’ type contraints in can add to make the follwing code compile ?
public class Plus<T> : BinaryOperator<T> where T : ...
{
public override T Evaluate(IContext<T> context)
{
return left.Evaluate(context) + right.Evaluate(context);
}
}
Thanks 🙂
There are no such devices in C#. A few options are available, though:
dynamic, which supports+but offers no compile time checkingOperatorclass which makes operators available as methods – again, without any compile-time checkingSo either:
or