Type.Module Property
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Gets the module (the DLL) in which the current Type is defined.
Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Syntax
Public MustOverride ReadOnly Property Module As Module
public abstract Module Module { get; }
Property Value
Type: System.Reflection..::.Module
The module in which the current Type is defined.
Remarks
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.
Examples
This following example demonstrates a use of the Namespace and Module properties and the ToString method of Type.
Note
To run this example, see Building examples that have static TextBlock controls for Windows Phone 8.
Namespace MyNamespace
Class [MyClass]
End Class '[MyClass]
End Namespace 'MyNamespace
Public Class Example
Public Shared Sub Demo(ByVal outputBlock As System.Windows.Controls.TextBlock)
Try
Dim myType As Type = GetType(MyNamespace.MyClass)
outputBlock.Text += String.Format(ControlChars.NewLine + "Printing the details of {0}." + ControlChars.NewLine, myType) & vbCrLf
' Get the namespace of the class Example.
outputBlock.Text += String.Format("Namespace: {0}.", myType.Namespace) & vbCrLf
' Get the name of the module.
outputBlock.Text += String.Format("Module: {0}.", myType.Module) & vbCrLf
' Get the fully qualified common language runtime namespace.
outputBlock.Text += String.Format("Fully qualified type: {0}.", myType.ToString()) & vbCrLf
Catch e As Exception
outputBlock.Text &= "Exception: " + e.Message.ToString() & vbCrLf
End Try
End Sub 'Main
End Class 'Type_ToString_3
using System;
namespace MyNamespace
{
class MyClass
{
}
}
public class Example
{
public static void Demo(System.Windows.Controls.TextBlock outputBlock)
{
try
{
Type myType = typeof(MyNamespace.MyClass);
outputBlock.Text += String.Format("\nPrinting the details of {0}.\n", myType) + "\n";
// Get the namespace of the class Example.
outputBlock.Text += String.Format("Namespace: {0}.", myType.Namespace) + "\n";
// Get the name of the module.
outputBlock.Text += String.Format("Module: {0}.", myType.Module) + "\n";
// Get the fully qualified common language runtime namespace.
outputBlock.Text += String.Format("Fully qualified type: {0}.", myType.ToString()) + "\n";
}
catch (Exception e)
{
outputBlock.Text += "Exception: " + e.Message + "\n";
}
}
}
Version Information
Windows Phone OS
Supported in: 8.1, 8.0, 7.1, 7.0
Platforms
Windows Phone