如何从程序集中获取所有信息?
我正在 C# 创建智能感知作为 Java 的智能感知。我有 TextBox,用户可以编写他想要获取的内容。如何从程序集中获取所有信息,因为它是类、常量、命名空间、基元、枚举或方法。 .?就像图片中的
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
我正在 C# 创建智能感知作为 Java 的智能感知。我有 TextBox,用户可以编写他想要获取的内容。如何从程序集中获取所有信息,因为它是类、常量、命名空间、基元、枚举或方法。 .?就像图片中的
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(2)
不太清楚你的意思,但你应该从:
Assembly.GetTypes
Type.GetMembers
或:Type.GetFields
Type.GetMethods
Type.GetProperties
(等)如果您确实选择
Type.GetMembers
,则可以使用MemberInfo.MemberType
。基本上查看
Type
、MethodInfo
等上可用的所有成员...如果您有任何更多特定问题,我们可能会更详细对那些有帮助。It's not really clear what you mean, but you should start with:
Assembly.GetTypes
Type.GetMembers
or:Type.GetFields
Type.GetMethods
Type.GetProperties
(etc)If you do go for
Type.GetMembers
, you can distinguish between them usingMemberInfo.MemberType
.Basically look at all the members available on
Type
,MethodInfo
etc... and if you have any more specific questions, we can probably be more helpful with those.在 C# 中,您可以使用 System.Reflection.Assemly 类/方法来执行此操作。
In C# you can use System.Reflection.Assemly class/methods to do that.