|
Este artigo foi traduzido por máquina. Coloque o ponteiro do mouse sobre as frases do artigo para ver o texto original. Mais informações.
|
Tradução
Original
|
Enumeração MemberTypes
Esta enumeração tem um atributo FlagsAttribute que permite uma combinação bit a bit de seus valores de membro.
Namespace: System.Reflection
Assembly: mscorlib (em mscorlib.dll)
| Nome do membro | Descrição | |
|---|---|---|
![]() | Constructor | |
![]() | Event | |
![]() | Field | |
![]() | Method | |
![]() | Property | |
![]() | TypeInfo | |
![]() | Custom | |
![]() | NestedType | |
![]() | All |
Primeiro obter um Type. Da Type, obter o MemberInfo array. Da MemberInfo de array, obtenha o MemberType.
using System; using System.Reflection; class membertypesenum { public static int Main(string[] args) { Console.WriteLine ("\nReflection.MemberTypes"); MemberTypes Mymembertypes; // Get the type of a chosen class. Type Mytype = Type.GetType ("System.Reflection.ReflectionTypeLoadException"); // Get the MemberInfo array. MemberInfo[] Mymembersinfoarray = Mytype.GetMembers(); // Get and display the name and the MemberType for each member. foreach (MemberInfo Mymemberinfo in Mymembersinfoarray) { Mymembertypes = Mymemberinfo.MemberType; Console.WriteLine("The member {0} of {1} is a {2}.", Mymemberinfo.Name, Mytype, Mymembertypes.ToString()); } return 0; } }
Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Função Server Core sem suporte), Windows Server 2008 R2 (Função Server Core com suporte com o SP1 ou posterior, Itanium sem suporte)
O .NET Framework não oferece suporte a todas as versões de cada plataforma. Para obter uma lista das versões com suporte, consulte .Requisitos de sistema do NET Framework.
