MethodInfo.MemberType Property indicates that this member is a method. : MethodInfo « Reflection « VB.Net






MethodInfo.MemberType Property indicates that this member is a method.

 

Imports System
Imports System.Reflection

Class MyMethodInfo

    Public Shared Function Main() As Integer
        ' Get the Type and MethodInfo.
        Dim MyType As Type = Type.GetType("System.Reflection.FieldInfo")
        Dim Mymethodinfo As MethodInfo = MyType.GetMethod("GetValue")
        Console.WriteLine(MyType.FullName + "." + Mymethodinfo.Name)

        ' Get and display the MemberType property.
        Dim Mymembertypes As MemberTypes = Mymethodinfo.MemberType

        If MemberTypes.Constructor = Mymembertypes Then
            Console.WriteLine("MemberType is of type All.")

        ElseIf MemberTypes.Custom = Mymembertypes Then
            Console.WriteLine("MemberType is of type Custom.")

        ElseIf MemberTypes.Event = Mymembertypes Then
            Console.WriteLine("MemberType is of type Event.")

        ElseIf MemberTypes.Field = Mymembertypes Then
            Console.WriteLine("MemberType is of type Field.")

        ElseIf MemberTypes.Method = Mymembertypes Then
            Console.WriteLine("MemberType is of type Method.")

        ElseIf MemberTypes.Property = Mymembertypes Then
            Console.WriteLine("MemberType is of type Property.")

        ElseIf MemberTypes.TypeInfo = Mymembertypes Then
            Console.WriteLine("MemberType is of type TypeInfo.")

        End If
        Return 0
    End Function
End Class

   
  








Related examples in the same category

1.MethodInfo.GetBaseDefinition
2.MethodInfo.ReturnType gets the return type of this method.
3.MemberInfo Class contains information about the attributes of a member
4.Display the set of assemblies our assemblies reference
5.Display information about each assembly loading into this AppDomain.
6.Get members from a Type
7.MemberInfo.DeclaringType Property gets the class that declares this member.
8.MemberInfo.GetCustomAttributes
9.MemberInfo.MemberType indicates the type of the member, method, constructor, event.
10.MemberInfo.Module Property gets the module
11.MemberInfo.Name gets the name of the current member.
12.MemberInfo.ReflectedType Property gets the class object that was used to obtain this instance of MemberInfo.
13.PropertyInfo Class represents the attributes of a property and provides access to property metadata.