This documentation is archived and is not being maintained.

Module.Assembly Property

Gets the appropriate Assembly for this instance of Module.

[Visual Basic]
Public ReadOnly Property Assembly As Assembly
[C#]
public Assembly Assembly {get;}
[C++]
public: __property Assembly* get_Assembly();
[JScript]
public function get Assembly() : Assembly;

Property Value

An Assembly object.

Example

[Visual Basic, C#, C++] The following example displays the full name of the specified assembly in the specified module.

[Visual Basic] 
Imports System
Imports System.Reflection

Namespace ReflectionModule_Examples
    Class MyMainClass
        Shared Sub Main()
            Dim moduleArray() As [Module]

            moduleArray = [Assembly].GetExecutingAssembly().GetModules(False)

            ' In a simple project with only one module, the module at index
            ' 0 will be the module containing this class.
            Dim myModule As [Module] = moduleArray(0)

            Dim myAssembly As [Assembly] = myModule.Assembly
            Console.WriteLine("myModule.Assembly = {0}.", myAssembly.FullName)
        End Sub 'Main
    End Class 'MyMainClass
End Namespace 'ReflectionModule_Examples

[C#] 
using System;
using System.Reflection;

namespace ReflectionModule_Examples
{
    class MyMainClass
    {
        static void Main()
        {
            Module[] moduleArray;
            
            moduleArray = Assembly.GetExecutingAssembly().GetModules(false);
            
            // In a simple project with only one module, the module at index
            // 0 will be the module containing this class.
            Module myModule = moduleArray[0];

            Assembly myAssembly = myModule.Assembly;
            Console.WriteLine("myModule.Assembly = {0}.", myAssembly.FullName);
        }
    }
}

[C++] 
#using <mscorlib.dll>

using namespace System;
using namespace System::Reflection;

int main()
{
   Module* moduleArray[];

   moduleArray = Assembly::GetExecutingAssembly()->GetModules(false);

   // In a simple project with only one module, the module at index
   // 0 will be the module containing this class.
   Module* myModule = moduleArray[0];

   Assembly* myAssembly = myModule->Assembly;
   Console::WriteLine(S"myModule.Assembly = {0}.", myAssembly->FullName);
}

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework, Common Language Infrastructure (CLI) Standard

See Also

Module Class | Module Members | System.Reflection Namespace

Show: