如何在用户定义的命名空间中获取类名 [英] How to get class names in a user defined namespace

查看:89
本文介绍了如何在用户定义的命名空间中获取类名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

HI,



如何获得位于同一解决方案中的项目的类名?



已经添加了对当前项目的引用,并在代码中使用了using.project1命名空间















感谢和问候,

Gayathri



how to get the class names of the project located in same solution ?

Already added the reference to the current project and used "using.project1"namespace in code







With thanks & Regards,
Gayathri

推荐答案

如果已添加引用(以及项目,而不是DLL文件)和相应的using语句,则代码中可以使用该命名空间中的公共类。 。



如果你无法访问它们,那么有几种可能性:

1)你想要使用的类是't public

2)您已引用其他项目的Release DLL文件,而不是引用项目本身:这意味着您需要为任何新的或更改的类构建发布版本。

3)项目如果您正在引用构建错误:在清除这些错误之前,新的和更改的类仍将无法使用。



如果您正在尝试查找有关可用内容的详细信息然后(正如Sinisa Hajnal所说)你需要反思才能在运行时找到它,或者使用Visual Studio中的Class View窗格来探索项目内容。
If you have added the reference (and to the project, not the DLL file) and the appropriate using statement, then the public classes within that namespace are then available in your code.

If you can't access them, then there are a couple of possibilities:
1) The classes you want to use aren't public.
2) You have referenced the Release DLL file of the other project instead of referencing the project itself: that means that you need to build the release version for any new or changed classes to be available.
3) The project you are referencing has build errors: until these are cleared, new and changed classes will still be unavailable.

If you are trying to find details about what is available within the project, then (as Sinisa Hajnal has said) you would need reflection to find out at run time, or use the Class View pane in Visual Studio to explore the project content.


这篇关于如何在用户定义的命名空间中获取类名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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