可以覆盖VB.NET根名称空间吗? [英] Possible to override VB.NET root namespace?
问题描述
VB.NET将在项目属性中设置的根名称空间自动前缀到每个类的名称空间.这与C#不同,在C#中,每次都必须声明完整的名称空间.
VB.NET automatically prefixes the root namespace set in the project properties to the namespace of each class. This is different from C#, where the full namespace must be declared each time.
是否有可能重写此行为,从而在根名称空间之外创建一个名称空间?
Is it possible to override this behaviour, creating a namespace outside of the root namespace?
推荐答案
如果我对您的理解正确,则只需要在项目属性对话框中设置一个空白名称空间,然后使用Begin/End Namespace命令在每个源文件中设置名称空间即可.
If I understand you correctly you just need to set a blank namespace in the project properties dialog and then set namespaces within each source file using Begin/End Namespace commands.
从VS2012起,可以解决此问题,请参见 stackoverflow.com/a/17360357/233095
From VS2012 onwards it's possible to get around this, see stackoverflow.com/a/17360357/233095
这篇关于可以覆盖VB.NET根名称空间吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!