reflection question

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is there a way to get the currently executing function/sub fully qualified
name for an assembly using reflection? e.g. "MyProject.MyClass.MyFunction"

TIA!
 
There are a couple different ways to get the method name. Here is one...

Dim fullMemberName As String
Dim mb As MethodBase = System.Reflection.MethodBase.GetCurrentMethod()
fullMemberName = mb.DeclaringType.FullName + "." + mb.Name
 
What about a way to get the method name on the calling assembly? e.g. I have
2 assemblies. 1 method in Assembly #1 calls a method in Assembly #2. Is
there anyway the method in Assembly #2 can know method name in Assembly #1?

thanks
 
That could be accomplished like this (from the called method in assembly
2)...

Dim trace As New StackTrace(1)
Dim mb As MethodBase = trace.GetFrame(0).GetMethod()
MessageBox.Show(mb.DeclaringType.FullName + "." + mb.Name)
 
Back
Top