Click here to Skip to main content
16,005,389 members
Home / Discussions / C#
   

C#

 
AnswerRe: Table information Pin
Roy Heil21-Dec-05 4:16
professionalRoy Heil21-Dec-05 4:16 
QuestionCustom Text on TaskBar Pin
Leyu21-Dec-05 2:47
Leyu21-Dec-05 2:47 
AnswerRe: Custom Text on TaskBar Pin
WetRivrRat21-Dec-05 3:41
WetRivrRat21-Dec-05 3:41 
GeneralRe: Custom Text on TaskBar Pin
Leyu24-Dec-05 20:50
Leyu24-Dec-05 20:50 
QuestionSQL Database Backup Restore through C#? Pin
manojk_batra21-Dec-05 2:06
manojk_batra21-Dec-05 2:06 
AnswerRe: SQL Database Backup Restore through C#? Pin
WetRivrRat21-Dec-05 6:42
WetRivrRat21-Dec-05 6:42 
QuestionIndigo Installation Problem Pin
srinivas_23421-Dec-05 1:01
srinivas_23421-Dec-05 1:01 
QuestionGetting the Namespace/Name of the calling method Pin
MrEyes21-Dec-05 0:57
MrEyes21-Dec-05 0:57 
Hello,

I am looking to find a way to retrieve the name of the method that called the current method. At first I thought there would be something within System.Reflection but unfortunately the only thing I can find is MethodInfo.GetCurrentMethod() which retrieves the name of the method I am currently in.

The reason for this is that I am in the process of creating a logging class, one of the logging functions allows the caller to log that a particular method has been called/exited. For ease and control I would prefer not to have to pass the function name/namespace as parameters. i.e.

private void MyFunction()
{
 LogFunctionEntry(MethodInfo.GetCurrentMethod())
}

public static void FunctionEntry(MethodInfo mi)
{
 string message = string.Format(
  System.Globalization.CultureInfo.InvariantCulture,
  "{0}.{1}",
  mi.ReflectedType,
  mi);

  Console.WriteLine(message);
}


At the moment the only other way I think of doing this is to parse through Environment.StackTrace but to be honest this is something I would rather not do.
AnswerRe: Getting the Namespace/Name of the calling method Pin
Guffa21-Dec-05 1:08
Guffa21-Dec-05 1:08 
GeneralRe: Getting the Namespace/Name of the calling method Pin
MrEyes21-Dec-05 1:12
MrEyes21-Dec-05 1:12 
GeneralRe: Getting the Namespace/Name of the calling method Pin
Vikram A Punathambekar21-Dec-05 1:17
Vikram A Punathambekar21-Dec-05 1:17 
GeneralRe: Getting the Namespace/Name of the calling method Pin
MrEyes21-Dec-05 1:21
MrEyes21-Dec-05 1:21 
GeneralRe: Getting the Namespace/Name of the calling method Pin
leppie21-Dec-05 4:10
leppie21-Dec-05 4:10 
GeneralRe: Getting the Namespace/Name of the calling method Pin
MrEyes21-Dec-05 4:15
MrEyes21-Dec-05 4:15 
GeneralRe: Getting the Namespace/Name of the calling method Pin
leppie21-Dec-05 4:28
leppie21-Dec-05 4:28 
QuestionExecutable Pin
charbelasmar21-Dec-05 0:33
charbelasmar21-Dec-05 0:33 
AnswerRe: Executable Pin
Vikram A Punathambekar21-Dec-05 1:19
Vikram A Punathambekar21-Dec-05 1:19 
AnswerRe: Executable Pin
Vikram A Punathambekar21-Dec-05 1:19
Vikram A Punathambekar21-Dec-05 1:19 
GeneralRe: Executable Pin
J4amieC21-Dec-05 3:23
J4amieC21-Dec-05 3:23 
GeneralRe: Executable Pin
Vikram A Punathambekar21-Dec-05 16:17
Vikram A Punathambekar21-Dec-05 16:17 
QuestionUser Controls access Page variable Pin
vinyladdict21-Dec-05 0:00
vinyladdict21-Dec-05 0:00 
QuestionGUI Question Pin
HolyGrandFather20-Dec-05 23:04
HolyGrandFather20-Dec-05 23:04 
AnswerRe: GUI Question Pin
WetRivrRat21-Dec-05 6:32
WetRivrRat21-Dec-05 6:32 
QuestionReverse Engineering Added Numbers Pin
redfish3420-Dec-05 22:41
redfish3420-Dec-05 22:41 
AnswerRe: Reverse Engineering Added Numbers Pin
Colin Angus Mackay20-Dec-05 22:49
Colin Angus Mackay20-Dec-05 22:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.