-2

I have a method in a class file. Say,

class A
{
     public void Getmethod(int first,int second)
        {
            Console.WriteLine("GetMethod");
        }
}

In my another class file, I have the following code

class B: A
    {
        A obj = new A();
        public  void  callingfunction()
         {
            obj.Getmethod(2,3);
         }
    }

Suppose I am storing the "Getmethod" name in a string variable, say Methodname. Is it posiible to find if my Methodname is being used anywhere else in my solution(that is it should check in all class files of a solution)

Malai
  • 63
  • 8
  • @Peter Duniho I am finding for C# CODE for this question and not through FIND ALL REFERENCE. So it is not a Duplicate – Malai Apr 04 '17 at 06:39
  • 1
    Actually it *is* a duplicate as the answer to the duplicate question tells you what you need to do. – Lasse V. Karlsen Apr 04 '17 at 06:40
  • Did you bother to look at the marked duplicate? It is _exactly_ the question you asked, and _not_ about using "Find All References..." in the IDE. – Peter Duniho Apr 04 '17 at 06:42

1 Answers1

1

Right click on the method in Visual Studio and Click Find All References

Finding References

Sadique
  • 22,572
  • 7
  • 65
  • 91
  • I am finding a C# programming code to find this. And not through `Find All Reference` – Malai Apr 04 '17 at 06:15
  • The only way to do that will be to actually run the code through a compiler and then analyze the results while it is still in a syntax tree or similar. Due to the optimizing nature of compilers the code may be optimized out before it reaches the final stage so looking at assemblies on disk may or may not give you what you want. May I ask *why* you need to do this yourself? – Lasse V. Karlsen Apr 04 '17 at 06:40