Module Property
Collapse the table of content
Expand the table of content

Type::Module Property

 

Gets the module (the DLL) in which the current Type is defined.

Namespace:   System
Assembly:  mscorlib (in mscorlib.dll)

public:
property Module^ Module {
	virtual Module^ get() abstract;
}

Property Value

Type: System.Reflection::Module^

The module in which the current Type is defined.

Implements

_Type::Module

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.

This following example demonstrates a use of the Namespace and Module properties and the ToString method of Type.

using namespace System;

namespace MyNamespace
{
   ref class MyClass
   {
   };
}

void main()
{
      Type^ myType = MyNamespace::MyClass::typeid;
      Console::WriteLine("Displaying information about {0}:", myType );

      // Get the namespace of the class MyClass.
      Console::WriteLine("   Namespace: {0}", myType->Namespace );

      // Get the name of the module.
      Console::WriteLine("   Module: {0}", myType->Module );

      // Get the fully qualified common language runtime namespace.
      Console::WriteLine("   Fully qualified type: {0}", myType );
}
// The example displays the following output:
//    Displaying information about MyNamespace.MyClass:
//       Namespace: MyNamespace
//       Module: type_tostring.exe
//       Fully qualified name: MyNamespace.MyClass

.NET Framework
Available since 1.1
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Return to top
Show:
© 2016 Microsoft