Why do they call assemblies for module

T

Tony Johansson

Hi!

Why do they call an assembly for module
Here I have an example of that. So when I call GetModules and write out this
I write out the exe file or dll file where this piece of code is located in.

Assembly ass = Assembly.GetExecutingAssembly();
foreach (Module mod in ass.GetModules())
{
Console.WriteLine("Module Name: {0} ", mod.Name);
}

//Tony
 
A

Arne Vajhøj

Why do they call an assembly for module
Here I have an example of that. So when I call GetModules and write out this
I write out the exe file or dll file where this piece of code is located in.

Assembly ass = Assembly.GetExecutingAssembly();
foreach (Module mod in ass.GetModules())
{
Console.WriteLine("Module Name: {0} ", mod.Name);
}

All normal assemblies just consist of one module, but you can
build an assembly consisting of multiple modules.

Arne
 
A

Arne Vajhøj

All normal assemblies just consist of one module, but you can
build an assembly consisting of multiple modules.

Demo:

C:\>type M:cs
The system cannot find the path specified.

C:\>type O.cs
using System;

public class O
{
public void FooBar()
{
Console.WriteLine("Hello world");
}
}

C:\>csc M.cs O.cs
Microsoft (R) Visual C# 2008 Compiler version 3.5.30729.1
for Microsoft (R) .NET Framework version 3.5
Copyright (C) Microsoft Corporation. All rights reserved.


C:\>M
Hello world
M.exe

C:\>csc /t:module O.cs
Microsoft (R) Visual C# 2008 Compiler version 3.5.30729.1
for Microsoft (R) .NET Framework version 3.5
Copyright (C) Microsoft Corporation. All rights reserved.


C:\>csc /t:exe /addmodule:O.netmodule M.cs
Microsoft (R) Visual C# 2008 Compiler version 3.5.30729.1
for Microsoft (R) .NET Framework version 3.5
Copyright (C) Microsoft Corporation. All rights reserved.


C:\>M
Hello world
M.exe
O.netmodule

Arne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top