Thomas Weller
Thomas Weller

Reputation: 59208

Definition of assembly in literature versus Assembly class

According to Microsoft Learn,

Assemblies take the form of executable (.exe) or dynamic link library (.dll) files, and are the building blocks of .NET applications.

According to the ECMA-334 specification, 7th edition,

assembly – one or more files output by the compiler as a result of program compilation

So, both definitions state that an assembly is a file. However, I can create an Assembly im memory, e.g. with the code

System.CodeDom.Compiler.CompilerParameters parameters = new CompilerParameters();
parameters.GenerateInMemory = true;
CompilerResults r = CodeDomProvider.CreateProvider("CSharp").CompileAssemblyFromSource(parameters, "public class A {public static int B=7;}");
Assembly a = r.CompiledAssembly;

With the GenerateInMemory flag set, there will not be a DLL or EXE on disk.

So, is there a difference between an assembly and Assembly objects, or are the definitions just sloppy? Why do we need the term "file" in the definition of an assembly at all?

Upvotes: 0

Views: 59

Answers (0)

Related Questions