C# FieldInfo Module

Description

FieldInfo Module Gets the module in which the type that declares the member represented by the current MemberInfo is defined.

Syntax

FieldInfo.Module has the following syntax.


public virtual Module Module { get; }

Example


using System;//  w w  w .  j  a  va 2 s .c om
using System.Reflection;

public class Test
{
    public override string ToString()
    {
        return "a value!";
    }
}

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.





















Home »
  C# Tutorial »
    System.Reflection »




EventInfo
FieldInfo
MemberInfo
MethodInfo
ParameterInfo
TypeInfo