-
Assembly
2012-08-23 12:07:32什么是Assembly(程序集)? Assembly是一个包含来程序的名称,版本号,自我描述,文件关联关系和文件位置等信息的一个集合。在.net框架中通过Assembly类来支持,该类位于System.Reflection下,物理位置位于:mscorlib...什么是Assembly(程序集)?
Assembly是一个包含来程序的名称,版本号,自我描述,文件关联关系和文件位置等信息的一个集合。在.net框架中通过Assembly类来支持,该类位于System.Reflection下,物理位置位于:mscorlib.dll。
Assembly能干什么?
我们可以通过Assembly的信息来获取程序的类,实例等编程需要用到的信息。
一个简单的演示实例:
1.建立一个Console工程名为:NamespaceRef
2.写入如下代码:
1using System;
2using System.Collections.Generic;
3using System.Text;
4using System.Reflection;
5
6namespace NamespaceRef
7{
8 class Program
9 {
10 static void Main(string[] args)
11 {
12 Country cy;
13 String assemblyName = @"NamespaceRef";
14 string strongClassName = @"NamespaceRef.China";
15 // 注意:这里类名必须为强类名
16 // assemblyName可以通过工程的AssemblyInfo.cs中找到
17 cy = (Country)Assembly.Load(assemblyName).CreateInstance(strongClassName);
18 Console.WriteLine(cy.name);
19 Console.ReadKey();
20 }
21 }
22
23 class Country
24 {
25 public string name;
26 }
27
28 class Chinese : Country
29 {
30 public Chinese()
31 {
32 name = "你好";
33 }
34 }
35
36 class America : Country
37 {
38 public America()
39 {
40 name = "Hello";
41 }
42 }
43}
由于Assembly的存在给我们在实现设计模式上有了一个更好的选择。
我们在开发的时候有时候会遇到这样的一个问题,根据对应的名称来创建指定的对象。如:给出chinese就要创建一个chinese对象,以前我们只能这样来写代码:
1if (strongClassName == "China")
2 cy = new China();
3else if (strongClassName == "America")
4 cy = new America();
那么如果我们有很长的一系列对象要创建,这样的代码维护起来是很困难的,而且也不容易阅读。现在我们可以通过在外部文件定义类的程序集名称和类的强名称来获得这样一个实例,即易于理解,又增强了扩展性还不用修改代码。
cy = (Country)Assembly.Load(assemblyName).CreateInstance(strongClassName);
结论
Assembly类有很多的方法和属性,它和Type一样有很多功能用于名称与方法和属性之间的转化。深入理解这两个类,你就可以清晰通用语言层是如何工作。 -
Assembly-Java:从Java实例调用Assembly-源码
2021-03-14 16:11:16Assembly-Java:从Java实例调用Assembly -
安装包解压后正常路径没有Assembly-CSharp.dll
2020-06-20 01:11:17如题,一个手游安装包解压后的正常路径没有Assembly-CSharp.dll这个文件,查找也没有,请问怎么办?[face]monkey:0.gif[/face][face]monkey:0.gif[/face][face]monkey:0.gif[/face] -
site_assembly
2017-12-19 15:46:25site_assembly site_assemblysite_assemblysite_assembly -
An assembly tolerance representation model based on spatial relations for generating assembly ...
2021-02-08 22:29:31An assembly tolerance representation model based on spatial relations for generating assembly tolerance types -
assembly.FullName.Contains ("Assembly") not working with Assembly Definition File
2020-12-31 11:29:56<div><p>Assembly Definition File create assembly dll file with custom name.</p><p>该提问来源于开源项目:Seneral/Node_Editor_Framework</p></div> -
x86-64-assembly:x86-64-assembly练习的回购-源码
2021-02-10 02:48:04x86-64-assembly 用于x86-64-assembly练习的回购。 -
assembly各种ASM
2011-01-24 09:44:22assembly assembly assembly assembly -
Deployment Assembly
2017-01-05 14:58:57Deployment AssemblyEclipse中classpath和deploy assembly的文件位置
classpath的配置信息存储在工程根目录下的.classpath文件
deploy assembly配置信息存储在工程目录下的.settings\org.eclipse.wst.common.component文件中
标准web工程通过m2eclipse添加依赖管理步骤:
1、“Maven ” –> “Enable dependency Management“2、Web Deployment Assembly中添加maven dependencies
步骤如下图:
工程 -> 右键 -> preferences
.classpath文件中会有修改- <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
为- <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER">
- <attributes>
- <attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
- </attributes>
- </classpathentry>
(执行“Maven ” –> “Update Project Configuration “未生效,故手动添加。必须deploy时候才会拷贝jar包到lib目录下,而非在更新maven依赖时候拷贝jar包。 )参考原文:http://blog.csdn.net/yirentianran/article/details/6429240
-
deployment assembly
2015-10-30 17:08:26 -
some assembly required
2015-08-20 05:53:22Some assembly required Assembly language programming with the AVR Microcontroller author: Timothy S. Margush -
Assembly Intro - Inline Assembly Versus Non-Inline Assembly
2015-07-16 17:11:27From a function viewpoint, function may be implmented ...by inline assembly way, or by non-inline assembly way. Example: inline assembly function int inline_add(int x, int y) { asm volatile ("adFrom a function viewpoint, function may be implmented
by inline assembly way, or by non-inline assembly way.Example:
inline assembly functionint inline_add(int x, int y)
{
asm volatile ("addl %%ebx,%%eax"
:"=a"(x)
:"a"(x), "b"(y)
);return x;
}// declare
int non_inline_add(int x, int y);int main()
{
int result;
result = inline_add(5, 10);
result = non_inline_add(5, 10);
return 0;
}
// implementationfile non_inline_add.S
.globl non_inline_add
non_inline_add:
pushq %rbp
movq %rsp, %rbpaddq %rsi, %rdi
movq %rdi, %raxleaveq
retq -
primitive assembly
2018-07-24 13:59:00Does clipping in openGL pipeline happen before or after primitive assembly? https://stackoverflow.com/questions/49860946/does-clipping-in-opengl-pipeline-happen-before-or-after-primitive-assembly ... -
spark-assembly
2018-05-29 19:56:11spark正常运行所需要的jar包,适用于spark1版本, 一个jar包中包含所有使用spark编程所需要的关键类,功能超级强大! spark-assembly-1.52-bc1.3.1-hadoop2.6.0-bc1.3.1.jar -
Change Assembly Version in a compiled .NET assembly
2019-10-07 08:28:23Change Assembly Version in a compiled .NET assembly You can use ILMerge: ILMerge.exe Foo.dll /ver:1.2.3.4 /out:Foo2.dll A valid reason to do this is to increment the assembly version in a bu... -
Assembly配置
2018-11-28 11:39:22assembly> <id>bin</id> <includeBaseDirectory>false</includeBaseDirectory> <!-- 最终打包成一个用于发布的zip文件 --> ... -
Existing long read assembly
2020-12-02 10:19:30<div><p>I have two long read assemblies that are better than the one in <code>003_long_read_assembly.gfa</code>: <code>minimap2</code> with <code>miniasm -c2</code> and Racon twice (good) and Canu ... -
An exception occurs when using Assembly.LoadFile() to dynamically load Assembly
2020-12-29 08:17:30<p>Everything is normal when loading an Assembly without any dependencies, but if this Assembly depends on other assemblies, the above error will occur when using Assembly.GetTypes()</p><p>该提问来源... -
assembly-version returns "Could not find entry assembly" in ASP.NET logging
2021-01-12 06:35:57<div><p>the ${assembly-version}</code> layout renderer returns "Could not find entry assembly" in ASP.NET. It seems that: <p><code>var assembly = Assembly.GetEntryAssembly();</code></p> ... -
maven 打jar包 mvn assembly:assembly
2016-12-23 15:33:18assembly:assembly maven-assembly-plugin make-zip package single src/main/resources/zip.xml -
KafkaOffsetMonitor-assembly-0.2.0.rar
2020-08-28 18:43:01KafkaOffsetMonitor-assembly-0.2.0.rar KafkaOffsetMonitor-assembly-0.2.0.rar KafkaOffsetMonitor-assembly-0.2.0.rar -
Assembly.Load,Assembly.LoadFrom,Assembly.LoadFile的简单用法
2017-04-23 17:57:22一.Assembly.Load 直接查看public static Assembly Load(AssemblyName assemblyRef)函数的摘要是这样写的: 通过给定程序集的长格式名称加载程序集。 例子:Assembly ass = Assembly.Load("ClassLibrary1"); ... -
C#Assembly.Load()、 Assembly.LoadFrom()、 Assembly.LoadFile()分别表示什么
2020-11-04 16:38:381.Assembly表示什么 (1)Assembly个程序集,它是一个可重用、没有版本冲突并且可以自我描述的公共语言运行时应用程序构建基块。 (2) Assembly类是 动态加载程序集,可以加载用于反射的程序集,但不能加载用于执行... -
MIPS Assembly Language
2013-04-25 21:59:231.MIPS Assembly Language (1).MIPS Assembly Language.pdf (2).MIPS Assembly Language Programmer's Guide.pdf (3).MIPS Assembly Language Programming(CS50 Discussion and Project Book).pdf 2.龙芯2E体系结构 ... -
Unity报错“Copying assembly from ‘Temp/Assembly-CSharp.dll‘ to ‘Library/ScriptAssemblies/Assembly...
2021-02-12 19:25:50Unity报错“Copying assembly from ‘Temp/Assembly-CSharp.dll’ to ‘Library/ScriptAssemblies/Assembly-CSharp.dll’ fail” 方法:保存当前所有改变然后退出Unity重启。 -
Assembly.LoadFrom throws 'already loaded' even if the assembly is not in memory
2021-01-11 15:21:40- if I remember well, the Assembly.LoadFrom of the .NET Framework does not throw even if the assembly was already loaded. Why did the behavior change?</p><p>该提问来源于开源项目:dotnet/runtime... -
assembly.xml
2018-12-21 09:39:00【官网地址】:http://maven.apache.org/plugins/maven-assembly-plugin/assembly.html <assembly xmlns="http://maven.apache.org/ASSEMBLY/2.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ... -
Copying assembly from ‘Temp/Assembly-CSharp.dll‘ to ‘Library/ScriptAssemblies/Assembly-CSharp.dll...
2021-01-26 11:21:01报错问题: Copying assembly from ‘Temp/Assembly-CSharp.dll’ to ‘Library/ScriptAssemblies/Assembly-CSharp.dll’ failed 腾讯电脑管家把 每次启动Unity的工程,Unity都会从“Temp文件夹”中拷贝Assembly-... -
T4 assembly
2014-11-27 14:23:00In a T4 template the executing assembly is not yours but one from the T4 engine. To access types from your assemblies, you have to perform the following steps: Add a reference to your assembly t...