本文介绍了如何理解命名空间的使用......的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 使用2.0与母版页和一个GlobalBaseClass用于内容页面。 我理解简单部分 - 命名空间的层次结构 命名惯例 - 但是2.0 IDE没有为 开发人员写一个签名,并且在开始开发2.0应用程序之后我认为我应该通过代码和开始标记类并使用 命名空间。即使在基类中使用 第一级命名空间,例如以及其他类 ,例如部分类,我仍然会收到以下丢失错误我写的和实用程序类。 //错误 无法找到类型或命名空间名称''GlobalBaseClass'(你是 缺少using指令或汇编引用?) 所以如果我尝试这个第一级签名... 命名空间CompanyName { .... } ''缺失''发生错误。 我已经有至少二十几个部分类的实例和四个 我自己的实用程序类。是否每个类都需要 中的第一级CompanyName命名空间?这些问题在我的 混乱的头脑中仍然是模糊不清的。 有人可以解释或提供一个博客或教程的URL,真正得到 编译器想要声明名称空间的位置和时间? <%= Clinton Gallagher 解决方案 看起来编译器无法解析类型GlobalBaseClass。 /> 它告诉你究竟是什么问题:要么你没有参考 到包含GlobalBaseClass的程序集,要么就是你的 命名空间,你不要使用,或者两者都使用。 问候 Richard Blewett - DevelopMentor http://www.dotnetconsult.co.uk/weblog http://www.dotnetconsult.co.uk Using 2.0 with Master Pages and a GlobalBaseClass for the content pages. I understand the easy part -- the hierarchical structure of a namespacenaming convention -- but the 2.0 IDE does not write a signature for thedeveloper and after getting a good start developing a 2.0 application Ithought I should go through the code and start marking classes and withnamespaces. I keep getting the following ''missing'' error even when using afirst level namespace in the base class for example as well as other classessuch as the partial class and utility classes I have written. // ErrorThe type or namespace name ''GlobalBaseClass'' could not be found (are youmissing a using directive or an assembly reference?) So if I try this first level signature... namespace CompanyName{....} The ''missing'' error occurs. I have at least two dozen instance of partial classes already and four ofmy own utility classes. Is the first level CompanyName namespace required ineach and every class? These are the sorts of issues that remain murky in mymuddled mind. Can somebody explain or provide a URL to a blog or tutorial that really getsinto where and when the compiler wants namespaces declared? <%= Clinton Gallagher 解决方案 It appears that the type GlobalBaseClass is not resolvable by the compiler.Its telling you exactly what the issue is: either you don''t have a referenceto the assembly that contains GlobalBaseClass or you do but its in anamespace that you don;t ave a using statement for - or maybe both. Regards Richard Blewett - DevelopMentor http://www.dotnetconsult.co.uk/weblog http://www.dotnetconsult.co.uk 这篇关于如何理解命名空间的使用......的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
09-19 01:21