Share via


ConstructorInfo.MemberType Property

Microsoft Silverlight will reach end of support after October 2021. Learn more.

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

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

Syntax

'Declaration
<ComVisibleAttribute(True)> _
Public Overrides ReadOnly Property MemberType As MemberTypes
[ComVisibleAttribute(true)]
public override MemberTypes MemberType { get; }

Property Value

Type: System.Reflection.MemberTypes
A value that indicates that this member is a constructor.

Remarks

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

Examples

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

Imports System.Reflection

Class Example

   Public Shared Sub Demo(ByVal outputBlock As System.Windows.Controls.TextBlock) 

      ' Get the Type and MemberInfo.
      Dim MyType As Type = GetType(System.Threading.Thread)

      ' Display the MemberType and the member.
      outputBlock.Text &= String.Format("There are {0} members in {1}:" & vbLf, _
         MyType.GetMembers().Length, MyType.FullName)

      For Each mi As MemberInfo In MyType.GetMembers()
         outputBlock.Text &= String.Format("  {0} - {1}" & vbLf, _
            mi.MemberType, mi)
      Next 

   End Sub
End Class
using System;
using System.Reflection;

class Example
{
   public static void Demo(System.Windows.Controls.TextBlock outputBlock)
   {
      // Get the Type and MemberInfo.
      Type MyType = typeof(System.Threading.Thread);

      // Display the MemberType and the member.
      outputBlock.Text += String.Format("There are {0} members in {1}:\n", 
         MyType.GetMembers().Length, MyType.FullName);

      foreach (MemberInfo mi in MyType.GetMembers())
      {
         outputBlock.Text += String.Format("  {0} - {1}\n",
            mi.MemberType, mi);
      }
   }
}

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.