ConstructorInfo::MemberType Property

 

Gets a MemberTypes value indicating that this member is a constructor.

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

public:
[ComVisibleAttribute(true)]
property MemberTypes MemberType {
	virtual MemberTypes get() override;
}

Property Value

Type: System.Reflection::MemberTypes

A MemberTypes value indicating that this member is a constructor.

This property overrides MemberType. Therefore, when you examine a set of MemberInfo objects — for example, the array returned by GetMembers — the MemberType property returns Constructor only when a given member is a constructor.

The following example uses the MemberType property to identify a MemberInfo object as a constructor.

using namespace System;
using namespace System::Reflection;
int main()
{
   Console::WriteLine( "\nReflection.MemberInfo" );

   // Get the Type and MemberInfo.
   Type^ MyType = Type::GetType( "System.Reflection.PropertyInfo" );
   array<MemberInfo^>^Mymemberinfoarray = MyType->GetMembers();

   // Get the MemberType method and display the elements.
   Console::Write( "\nThere are {0} members in ", Mymemberinfoarray->GetLength( 0 ) );
   Console::Write( "{0}.", MyType->FullName );
   for ( int counter = 0; counter < Mymemberinfoarray->Length; counter++ )
   {
      Console::Write( "\n{0}. {1} Member type - {2}", counter, Mymemberinfoarray[ counter ]->Name, Mymemberinfoarray[ counter ]->MemberType );

   }
   return 0;
}

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