How can I check whether a certain type implements a certain operator?
struct CustomOperatorsClass { public int Value { get; private set; } public C
An extension method called HasAdditionOp like this:
HasAdditionOp
pubilc static bool HasAdditionOp(this Type t) { var op_add = t.GetMethod("op_Addition"); return op_add != null && op_add.IsSpecialName; }
Note that IsSpecialName prevents a normal method with the name "op_Addition";
IsSpecialName