究竟什么是装配在C#或.NET? [英] What exactly is an Assembly in C# or .NET?

查看:141
本文介绍了究竟什么是装配在C#或.NET?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

能否请您解释一下什么是程序集在C#或.NET?

  1. 在它在哪里开始在哪里结束?
  2. 我应该知道的组件是什么重要的信息?
解决方案

程序集是编译后的输出你的code,通常是一个DLL,但是你的EXE也是一个组装。这是部署的最小单位为任何.NET项目。

组装通常包含.NET code在MSIL(微软中间语言),将被编译为本地code(即时编译 - 由刚刚在即时编译器编译)第一时间是给定的机器上执行。这编译code也将存储在装配和再利用在后续调用。

该组件还可以包含像图标,位图字符串表等资源。此外,大会还包含元数据的程序集清单 - 样的版本号,强名称,区域性,引用的程序集等信息。

在99%的情况下,一个组件相当于磁盘上的物理文件 - 一个多文件组件(一个程序集,分布在一个以上的文件)的情况下,似乎是一个相当奇怪的球优势的情况下这我从来没有在我的5年以上.NET开发中遇到的至今。

在一个多文件汇编仍然会有唯一一个集清单的DLL或EXE和MSIL code在多个netmodule文件。

Could you please explain what is an Assembly in C# or .NET?

  1. Where does it begin and where does it end?
  2. What important information should I know about Assemblies?

解决方案

An assembly is the compiled output of your code, typically a DLL, but your EXE is also an assembly. It's the smallest unit of deployment for any .NET project.

The assembly typically contains .NET code in MSIL (Microsoft Intermediate language) that will be compiled to native code ("JITted" - compiled by the Just-In-Time compiler) the first time it is executed on a given machine. That compiled code will also be stored in the assembly and reused on subsequent calls.

The assembly can also contain resources like icons, bitmaps, string tables and so on. Furthermore, the assembly also contains metadata in the assembly manifest - information like version number, strong name, culture, referenced assemblies and so forth.

In 99% of your cases, one assembly equals a physical file on disk - the case of a multi-file assembly (one assembly, distributed across more than a single file) appears to be a rather odd-ball edge case which I've never encountered so far in my 5+ years of .NET development.

In a multifile assembly there would still be only one assembly manifest in a DLL or EXE and the MSIL code in multiple netmodule files.

这篇关于究竟什么是装配在C#或.NET?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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