1

当我在 Visual Studio 中右键单击一个类(这是第三方程序集的一部分 - 不是我编写的代码)并选择“转到定义”时,我可以看到该类的所有方法、属性等。

我注意到所有这些都是public并且没有private显示(或任何其他访问级别)成员。

此功能是否仅显示public班级成员?

4

1 回答 1

3

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.
于 2018-05-04T09:25:16.323 回答