Exactly what I was looking for...I don't know a lot about reflection, so I wonder if there is a more elegant way to get this info.

posted on Friday, August 11, 2006 5:00 PM | Filed Under [ .NET ]

Comments

Gravatar
# re: RE: Finding calling method using reflection
on 8/11/2006 5:00 PM
return new StackFrame(2, false).GetMethod()
Gravatar
# re: RE: Finding calling method using reflection
Posted by Haacked
on 8/11/2006 5:50 PM
That should probably be

return new StackFrame(1, false).GetMethod()

In my code, I had a method called GetCallingMethod() so it has to pass in 2 to be useful.
Gravatar
# re: RE: Finding calling method using reflection
Posted by Chris Frazier
on 8/14/2006 10:18 AM
GetCallingMethod is closer to what I was looking for. Thanks!
Comments have been closed on this topic.