Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Getting calling method name?
Message
De
26/02/2013 19:17:53
John Baird
Coatesville, Pennsylvanie, États-Unis
 
 
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
C# 4.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01566974
Message ID:
01566999
Vues:
51
This message has been marked as a message which has helped to the initial question of the thread.
J'aime (1)
>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
Fil
Voir

Click here to load this message in the networking platform