MemberInfo.Module Property
Gets the module in which the type that declares the member represented by the current MemberInfo is defined.
Namespace: System.Reflection
Assembly: mscorlib (in mscorlib.dll)
Property Value
Type: System.Reflection.ModuleThe Module in which the type that declares the member represented by the current MemberInfo is defined.
| Exception | Condition |
|---|---|
| NotImplementedException | This method is not implemented. |
This property is provided as a convenience. It is equivalent to using the DeclaringType property to get the type in which the method is declared, and then calling the Module property of the resulting Type object.
The following code example declares a class that inherits Object and overrides Object.ToString. The example obtains MethodInfo objects for the class's ToString method and for the inherited GetHashCode method, and displays the names of the modules in which the two methods are declared.
Imports System Imports System.Reflection Public Class Test Public Overrides Function ToString() As String Return "An instance of class Test!" End Function End Class Public Class Example Public Shared Sub Main() Dim t As New Test() Dim mi As MethodInfo = t.GetType().GetMethod("ToString") Console.WriteLine(mi.Name & " is defined in " & mi.Module.Name) mi = t.GetType().GetMethod("GetHashCode") Console.WriteLine(mi.Name & " is defined in " & mi.Module.Name) End Sub End Class ' This example produces code similar to the following: ' 'ToString is defined in source.exe 'GetHashCode is defined in mscorlib.dll
Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.