转到仅显示公共成员的班级定义 [英] Go to Definition of class only showing public members

查看:90
本文介绍了转到仅显示公共成员的班级定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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.

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

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

此功能仅显示类的public个成员吗?

Does this feature only show public members of the class?

推荐答案

您可以在

当您尝试运行转到定义窥视定义命令时 对于标记为内部的类型或成员,Visual Studio会 不会将其元数据显示为源代码,无论 引用程序集是否是朋友.

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:

  • 使用反编译工具,例如ILSpy.
  • 在Visual Studio 2017 15.6及更高版本中,您可以设置一个选项来查看类型的定义,以查看反编译的源代码.可以在Tools > Options > Text Editor > C# > Advanced部分中启用此功能.
  • 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.

这篇关于转到仅显示公共成员的班级定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆