views:

65

answers:

1

Is it possible to retrieve the MethodInfo for * operator on an Int32?

I've tried this code but without success (it returns null):

MethodInfo mi = typeof(System.Int32).GetMethod("op_Multiply");

Thanks!

+4  A: 

No, it's not possible - no such method exists.

Arithmetic on primitive types (except Decimal) is implemented as IL instructions (mul, add, div, etc), not methods.
You can see the complete list of IL opcodes here.

SLaks
Indeed not possible. A `decimal` is not a primitive type though. If you (Stringer) wants "proof" of this impossibility, try Reflector: http://www.red-gate.com/products/reflector/
Abel
Ok I see, they are meta-data only.
Stringer Bell