views:

645

answers:

2

Can I get the current method's MethodInfo somehow?

+7  A: 

Found it myself after some screwing around with the reflection namespace...

System.Reflection.MethodBase.GetCurrentMethod()

borisCallens
Hehe. You just beat me to it! Note that this returns a MethodBase object, not a MethodInfo. But that may be just what you are after.
Rune Grimstad
now accept the the answer, and get a new badge:-)
Greg Dean
Well, actually I can't accept my answer untill after 24 hours. Although I did get the batch anyway :P But I'm not really a badge hunter. SO has much more to offer then a coding RPG
borisCallens
+1  A: 

Try the System.Reflection.MethodBase.GetCurrentMethod static method.

Rune Grimstad