ConstructorInfo.MemberType 属性   
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取 MemberTypes 值,该值指示此成员是构造函数。
public:
 virtual property System::Reflection::MemberTypes MemberType { System::Reflection::MemberTypes get(); };public override System.Reflection.MemberTypes MemberType { get; }[System.Runtime.InteropServices.ComVisible(true)]
public override System.Reflection.MemberTypes MemberType { get; }member this.MemberType : System.Reflection.MemberTypes[<System.Runtime.InteropServices.ComVisible(true)>]
member this.MemberType : System.Reflection.MemberTypesPublic Overrides ReadOnly Property MemberType As MemberTypes属性值
MemberTypes 值,指示此成员是构造函数。
实现
- 属性
示例
以下示例使用 MemberType 属性将 对象标识 MemberInfo 为构造函数。
using System;
using System.Reflection;
class Mymemberinfo
{
    public static int Main()
    {
        Console.WriteLine ("\nReflection.MemberInfo");
        // Get the Type and MemberInfo.
        Type MyType = Type.GetType("System.Reflection.PropertyInfo");
        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" + counter + ". "
                + Mymemberinfoarray[counter].Name
                + " Member type - " +
                Mymemberinfoarray[counter].MemberType.ToString());
        }
        return 0;
    }
}
Imports System.Reflection
Class Mymemberinfo
    Public Shared Function Main() As Integer
        Console.WriteLine(ControlChars.Cr + "Reflection.MemberInfo")
        ' Get the Type and MemberInfo.
        Dim MyType As Type = Type.GetType("System.Reflection.PropertyInfo")
        Dim Mymemberinfoarray As MemberInfo() = MyType.GetMembers()
        ' Get the MemberType method and display the elements.
        Console.Write(ControlChars.Cr + "There are {0} members in ", _
           Mymemberinfoarray.GetLength(0))
        Console.Write("{0}.", MyType.FullName)
        Dim counter As Integer
        For counter = 0 To Mymemberinfoarray.Length - 1
            Console.Write(ControlChars.CrLf + counter.ToString() + ". " _
               + Mymemberinfoarray(counter).Name _
               + " Member type - " _
               + Mymemberinfoarray(counter).MemberType.ToString())
        Next counter
        Return 0
    End Function
End Class
注解
此属性替代 MemberType。 因此,在检查一组 MemberInfo 对象(例如,返回 GetMembers 的数组)时,仅当给定成员是构造函数时, MemberType 属性才返回 Constructor 。