John Baird
Coatesville, Pennsylvanie, États-Unis
Information générale
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Network:
Windows 2003 Server
J'aime (1)
Naomi Nosonovsky
>Hi everybody,
>
>I have a method which I call from another method. I am wondering whether is a way to get that calling method's name in the current method?
>
>I want to use this for logging. I guess I can pass the method's name as alternative.
>
>Thanks in advance.
>
>In other words, the same class
>
>MethodA
> if (MethodB)
> ...
>
>
>In methodB I want to get the 'MethodA' string.
Look at the CallerMemberName capability of c#
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement