Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio: How to find all calls to function

There are two calls to the function B:Bla below, but looking at the call hierarchy (Cntl-K Cntl-T) and then 'Calls to' for each of A:Bla and B:Bla yields that one call is going to A and one call is going to B.

I'm working on a very large code base and sometimes I want the all calls to a function and I don't want to click 'Calls to' for each function in the inheritance chain. So for the below example, I would like 'Calls to' to return both calls, regardless of whether I called it on A:Bla or B:Bla.

using System;

class A
{
    public virtual int Bla() {
        return 65;
    }
}

class B : A
{
    public override int Bla()
    {
        return 66;
    }

    int Helper()
    {
        return this.Bla();
    }

    static void Main()
    {
        A obj = new B();
        Console.WriteLine(obj.Bla());
        Console.Read();
    }
}
like image 873
countunique Avatar asked Jul 05 '13 21:07

countunique


People also ask

How do I see all methods in visual studio?

The keyboard shortcut is Ctrl + Shift + E .

How do you call a function in Visual Studio?

Calling a Function Syntax. The syntax for calling a function in VB and VBA is lvalue = functionName (argument1, argument2) .

What does call mean in Visual Basic?

You can use the Call keyword when you call a procedure. For most procedure calls, you aren't required to use this keyword.


1 Answers

You can use the 'Find All References' function, highlight the method in question and press Ctrl + F12, or right click and pick Find All References.

This will then show the results in the Find Symbol Results window.

Please see this link for more details information. http://www.blackwasp.co.uk/VSFindAllReferences.aspx

like image 172
OCDan Avatar answered Oct 21 '22 05:10

OCDan