NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

MemberTypes Enumeration

Specifies a type of member.

[Visual Basic]
Public Enum MemberTypes
[C#]
public enum MemberTypes
[C++]
public enum MemberTypes

[JScript] In JScript, you can use the enumerations in the NGWS frameworks, but you cannot define your own.

Remarks

The MemberTypes enumeration is a subclass of MemberInfo and is a bit mask marking each type of Member that is defined as a subclass of MemberInfo. This enumeration matchs the CorTypeAttr defined in CorHdr.h.

These are returned by MemberType and are useful in switch statements. MemberTypes is returned by MemberInfo.MemberType and is useful in switch statements.

To obtain this MemberTypes value for a method:

Members

Member Name Description
All All member types. (Constructor | Event | Field | Method | Property | TypeInfo).
Constructor Constructor. It represents a ConstructorInfo member. Hex value of 0x01.
Custom Custom member type. Hex value of 0x40.
Event Event. It represents an EventInfo member. Hex value of 0x02.
Field Field. It represents a FieldInfo member. Hex value of 0x04.
Method Method. It represents a MethodInfo member. Hex value of 0x08.
NestedType Extends MemberInfo.
Property Property. It represents a PropertyInfo member. Hex value of 0x10.
TypeInfo Type. It represents a TypeInfo member. Hex value of 0x20.

Requirements

Namespace: System.Reflection

Assembly: mscorlib.dll

Example

class membertypesenum

{

public static int Main(string[] args)

{

Console.WriteLine ("\nReflection.MemberTypes");

MemberTypes Mymembertypes;

//Get the type

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)

{

Console.Write ("\n" + Mymemberinfo.Name);

Mymembertypes = Mymemberinfo.MemberType;

Console.Write (" is a "

+ EnumInfo.ToString(Type.GetType(

"System.Reflection.MemberTypes"),Mymembertypes));

}

return 0;

}

}

Produces the following output

Reflection.MemberTypes

GetType is a Method

ToString is a Method

.

.

.

.ctor is a Constructor

Types is a Property

LoaderExceptions is a Property.

See Also

System.Reflection Namespace