名称空间和库有什么区别? [英] what is difference between namespace and library ?

查看:280
本文介绍了名称空间和库有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对命名空间和库感到困惑.
plz help

I am confused between namespace and library.
plz help

推荐答案

hi
.NET中的主要类库是mscorlib.dll.该库包含大量核心类型,这些核心类型封装了各种常见任务.当是.NET应用程序时,将自动访问此库.我们可以通过查看全局程序集缓存来查看.NET Framework提供的类库(转到C:\ Windows \ Assembly或C:\ Winnt \ Assembly).

类库是.NET Framework的另一个主要实体.该库使程序可以访问运行时环境.类库包含许多预编写的代码,.NET中创建的所有应用程序都将使用这些代码.表单,控件等所有元素的代码实际上都来自类库.

命名空间是程序集中包含的相关类型的分组.例如,System.Drawing命名空间由类,方法组成,这些类和方法被组合在一起以实现相似的任务.

请注意,任何可在.NET环境中使用的语言,都以.NET框架提供的相同名称空间和类型为目标.

还要注意,像mscorlib.dll这样的单个程序集可以包含任意数量的名称空间.实际上,名称空间可能是嵌套的(表示名称空间中的名称空间),以分层方式安排类.
hi
The main class library in .NET is mscorlib.dll. This library contains a large number of core types that encapsulate a wide variety of common tasks. When a .NET application, there is automatic access to this library. We may view the class libraries provided by the .NET Framework by seeing the Global Assembly Cache (Go to C:\Windows\Assembly OR C:\Winnt\Assembly).

Class Library is another major entity of the .NET Framework. This library gives the program access to runtime environment. The class library consists of lots of prewritten code that all the applications created in .NET will use. The code for all the elements like forms, controls actually comes from the class library.

Namespace is a grouping of related types contained in an assembly. For example, the System.Drawing namespace consists of classes, methods that are grouped together to achieve similar tasks.

Note that any language, that works on the .NET environment, targets the same set of namespaces & types provided by the .NET framework.

Also note that a single assembly like mscorlib.dll may contain any number of namespaces. In fact, namespaces may be nested (means a namespace within a namespace) to arrange classes in a hierarchical fashion.


库通常是一个文件,其中包含一些您可以在应用程序中使用的功能,例如dll和jar文件.
该库提供给您的功能/类可以分组为名称空间.命名空间的主要功能是对功能/类进行逻辑分组,并避免名称冲突.
A library is generally a file containing some functionality you can use in your application, e.g. dll- and jar-file.
The functionality/classes that the library exposes to you can be group into namespaces. The primary function of namespaces are to group functionality/classes logically and to avoid name clashes.


它们并不是真正可比的术语!

命名空间是相关类的分组,它们可以对在命名空间中可以访问的内容施加限制.是
抽象(或逻辑)容器或环境-不必包含在单个文件中.

库是资源的集合(可以是常量,方法,类,图像或其他信息),可以包含零个,一个或多个命名空间.通常,一个库包含在一个文件中,尽管它可能引用其他库文件中的项目.

[edit]从图书馆"段落中删除了收藏"一词-OriginalGriff [/edit]
They aren''t really comparable terms!

A Namespace is a grouping together of related classes, which can apply restrictions as to what can be accessed within the namespace. It is
an abstract (or logical) container or environment - it does not have to be contained in a single file.

A Library is a collection of resources (which may be constants, methods, classes, images, or other information), which may contain zero, one or more namespaces. Normally, a Library is contained in a single file, although it may reference items in other library files.

[edit]Missed out the word "collection" from the Library paragraph - OriginalGriff[/edit]


这篇关于名称空间和库有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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