开发者

namespace and use keyword [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the he开发者_如何学编程lp center. Closed 12 years ago.

why use of namespace and use keyword and declaration of namespace


Namespaces are used for organizing the types in the code in a logical manner. Imagine the Base Class Library itself, with its many thousands of types, without namespaces. It is simply a tool for making code more structured, much like the ability to create directories in the file system helps you organize your files.

Now, since the full name of a type is the namespace and type name, these may become fairly long. In order to make this easier on you as a developer, you can tell the compiler that you are using types from certain namespaces in a code file with using (or Imports in VB.NET) directives, and then you don't need to use the full name in that file. It simply tells the compiler where to go look for any type that is not entered using the full name in the code.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜