I have C# Function like this :
private void test(){}
Is there any way to find Invoker or caller of a function ?
For example :
private void Caller(){
test();
}
then how can I understand that test was invoked by Caller ?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can get the names of the methods from call stack.
When you call a function, the name also as the other info is pushed to call stack so the program knows how to return from that function call. You can use that info to obtain the previous function that called your test() function.
To get stacktrace you can use the following: