Expand Minimize

Type.Module Property

Gets the module (the DLL) in which the current Type is defined.

Namespace:  System
Assembly:  mscorlib (in mscorlib.dll)

'Declaration
Public MustOverride ReadOnly Property Module As Module

Property Value

Type: System.Reflection.Module
The module in which the current Type is defined.

Implements

_Type.Module

If the current Type represents a constructed generic type, this property returns the module in which the generic type definition was defined. For example, if you create an instance of MyGenericStack<int>, the Module property for the constructed type returns the module in which MyGenericStack<T> is defined.

Similarly, if the current Type represents a generic parameter T, this property returns the assembly that contains the generic type that defines T.

This following example demonstrates a use of the Namespace and Module properties and the ToString method of Type.

Namespace MyNamespace
    Class [MyClass]
    End Class  
End Namespace  

Public Class Example
    Public Shared Sub Main()
         Dim myType As Type = GetType(MyNamespace.MyClass)
         Console.WriteLine(", myType)
         ' Get the namespace of the MyClass class.
         Console.WriteLine("   Namespace: {0}.", myType.Namespace)
         ' Get the name of the module.
         Console.WriteLine("   Module: {0}.", myType.Module)
         ' Get the fully qualified type name.
         Console.WriteLine("   Fully qualified name: {0}.", myType.ToString())
    End Sub 
End Class 
' The example displays the following output: 
'       Displaying information about MyNamespace.MyClass: 
'          Namespace: MyNamespace. 
'          Module: type_tostring.exe. 
'          Fully qualified name: MyNamespace.MyClass.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

XNA Framework

Supported in: 3.0, 2.0, 1.0

Supported in: Windows Phone 8.1

Supported in: Windows Phone Silverlight 8.1

Supported in: Windows Phone Silverlight 8
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2015 Microsoft