Get the module (the DLL) in which the current Type is defined in CSharp

Description

The following code shows how to get the module (the DLL) in which the current Type is defined.

Example


using System;/*ww  w . j av  a2 s.  com*/

namespace MyNamespace
{
    class MyClass
    {
    }
}

public class Example
{
    public static void Main()
    {
         Type myType = typeof(MyNamespace.MyClass);
         Console.WriteLine("Displaying information about {0}:", myType); 
         Console.WriteLine("   Namespace: {0}.", myType.Namespace);
         Console.WriteLine("   Module: {0}.", myType.Module);
         Console.WriteLine("   Fully qualified name: {0}.", myType.ToString());
    }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    Reflection »




Array
Constructor
Event
Field
Interface
Method
Properties
Type