Google グループは Usenet の新規の投稿と購読のサポートを終了しました。過去のコンテンツは引き続き閲覧できます。
Dismiss

Full qual. name of current method

閲覧: 34 回
最初の未読メッセージにスキップ

pamela...@libero.it

未読、
2006/10/17 8:26:412006/10/17
To:

Hi guys,

How do I get the full name of the current (overload) function or sub
(whatever it be) ?

Sub SomeFunction()

Dim FullNameOfThisFunction = ???
msgbox(FullNameOfThisFunction )

end sub

-P

Phill W.

未読、
2006/10/17 9:12:482006/10/17
To:
pamela...@libero.it wrote:

> How do I get the full name of the current (overload) function or sub
> (whatever it be) ?

Imports System.Reflection

Dim mb as MethodBase _
= MethodBase.GetCurrentMethod()

? mb. ...

HTH,
Phill W.

pamela...@libero.it

未読、
2006/10/17 10:08:462006/10/17
To:

Phill W. ha scritto:

>
> Dim mb as MethodBase _
> = MethodBase.GetCurrentMethod()
>

Thanks Phill . Very helpful.
I would also need the name of the caller. Is it simple to get ?

Sub Caller
me.CalledBy()
end sub

Sub CalledBy()
Dim FullNameOfCallerSub = ?????
msgbox(FullNameOfCallerSub)
end sub

Herfried K. Wagner [MVP]

未読、
2006/10/17 11:20:032006/10/17
To:
<pamela...@libero.it> schrieb:

'MethodBase.GetCurrentMethod().Name'

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Jay B. Harlow

未読、
2006/10/18 9:19:112006/10/18
To:
Pamela,

> I would also need the name of the caller. Is it simple to get ?
You can use the System.Diagnostics.StackTrace &
System.Diagnostics.StackFrame classes.

Dim trace As New StackTrace()
Dim caller As StackFrame = trace.GetFrame(1)
Debug.WriteLine(caller.GetMethod(), "caller")


--
Hope this helps
Jay B. Harlow
.NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley - http://www.tsbradley.net


<pamela...@libero.it> wrote in message
news:1161094126.5...@b28g2000cwb.googlegroups.com...

pamela...@libero.it

未読、
2006/10/19 12:52:162006/10/19
To:

Jay B. Harlow ha scritto:

> Pamela,
> > I would also need the name of the caller. Is it simple to get ?
> You can use the System.Diagnostics.StackTrace &
> System.Diagnostics.StackFrame classes.
>
> Dim trace As New StackTrace()
> Dim caller As StackFrame = trace.GetFrame(1)
> Debug.WriteLine(caller.GetMethod(), "caller")
>
>
> --
> Hope this helps

Thanks very helpful.

Thanks to all.

新着メール 0 件