Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / July 2005

Tip: Looking for answers? Try searching our database.

reflection question

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
param@community.nospam - 21 Jul 2005 22:48 GMT
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!
Tim Wilson - 21 Jul 2005 23:11 GMT
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

Signature

Tim Wilson
.Net Compact Framework MVP

> 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!
param@community.nospam - 23 Jul 2005 17:21 GMT
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

> There are a couple different ways to get the method name. Here is one...
>
[quoted text clipped - 8 lines]
>>
>> TIA!
Tim Wilson - 23 Jul 2005 18:09 GMT
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)

Signature

Tim Wilson
.Net Compact Framework MVP

> 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
[quoted text clipped - 14 lines]
> >>
> >> TIA!

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.