Determining where a function is defined in C #?

I am a complete newbie in C # (I have never used it before), and lately I needed to learn the code written in it. I spent the longest time trying to track down a nonexistent method in a class that does not seem to be defined anywhere in the class that used it. Later, I found out that this is the “extension method” that I am collecting - it is a method grafted by some other class to another class.

I fully understand the rationale for this language function and actually find it pretty enjoyable. However, as a person who does not have much experience in this language, it complicates the search for unfamiliar methods, since this method can be defined anywhere.

My question is this: given an unfamiliar method call in C #, what is the best way for me to find additional information about this, given that it could be an extension method defined in a completely separate class?

+3
source share
3 answers

I would just right-click on a function and select "Go to Definition".

+9
source

In the standard C # environment key set:

F12: Go to definition

Cntrl + -(Minus): Go back to the last mouse position (basically go back to where you were before)

+1
source

What information do you want? If this is a regular extension that is defined in the structure, you can search for information on msdn . Other than that, I also recommend the solution that Uwe Keim wrote, right-click and select "Goto definition".

0
source

Source: https://habr.com/ru/post/1784302/


All Articles