0

Is there a way to analyze that a function calls other functions or uses which variables in C#? For instance,

class Test
{
    public int a;
    public void function1()
    {
        a = 1;
        function2();
    }

    public void function1()
    {
        function2();
    }
}

So how to know the function1 uses a and calls the function2?

zhengkai wang
  • 101
  • 10

1 Answers1

0

Yes you can use StackTrace class to analyse the call stack for function https://msdn.microsoft.com/en-us/library/system.diagnostics.stacktrace(v=vs.110).aspx

Hope this helps

Toan Nguyen
  • 11,263
  • 5
  • 43
  • 59