C# MethodInfo Module
Description
MethodInfo Module
Gets the module in which the type that
declares the member represented by the current MemberInfo is defined.
Syntax
MethodInfo.Module
has the following syntax.
public virtual Module Module { get; }
Example
using System;//from w w w . jav a 2 s .co m
using System.Reflection;
public class Test
{
public override string ToString()
{
return "An instance of class Test!";
}
}
public class Example
{
public static void Main()
{
Test t = new Test();
MethodInfo mi = t.GetType().GetMethod("ToString");
Console.WriteLine("{0} is defined in {1}", mi.Name, mi.Module.Name);
mi = t.GetType().GetMethod("GetHashCode");
Console.WriteLine("{0} is defined in {1}", mi.Name, mi.Module.Name);
}
}
The code above generates the following result.