Go to Definition of class only showing public members

北城以北 提交于 2019-12-01 09:56:06

问题


When I right click on a class (that is part of an third party assembly - not code I have written) in Visual Studio and select "Go to Definition", I can see all the methods, properties etc of the class.

I notice all these are all public and no private(or any other level of access) members are shown.

Does this feature only show public members of the class?


回答1:


You can find the answer on the doc page:

When you try to run the Go To Definition or Peek Definition command for types or members that are marked as internal, Visual Studio does not display their metadata as source code, regardless of whether the referencing assembly is a friend or not.

If you want to see the source code of the assembly, you have two options:

  • Use a decompile tool like e.g. ILSpy.
  • In Visual Studio 2017 version 15.6+, you can set an option to see decompiled source code when you view the definition of a type. This feature can be enabled in the Tools > Options > Text Editor > C# > Advanced section.


来源:https://stackoverflow.com/questions/50171458/go-to-definition-of-class-only-showing-public-members

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!