Use Reflection to get all member names : MethodInfo « Reflection « VB.Net Tutorial






Module Module1
    Class Book
        Public Title As String
        Public Author As String
        Public Price As Double

        Public Sub New(ByVal Title As String, ByVal Author As String, ByVal Price As Double)
            Me.Title = Title
            Me.Author = Author
            Me.Price = Price
        End Sub

        Public Sub ShowTitle()
            Console.WriteLine("Title: " & Title)
        End Sub

        Public Sub ShowBook()
            Console.WriteLine("Title: " & Title)
            Console.WriteLine("Author: " & Author)
            Console.WriteLine("Price: " & Price)
        End Sub

    End Class

    Sub Main()
        Dim NetBook As New Book("AAA","BBB", 49.99)

        Console.WriteLine("Member Names")
        Dim Member As Reflection.MemberInfo

        For Each Member In NetBook.GetType.GetMembers()
            Console.WriteLine(Member.Name)
        Next

    End Sub

End Module
Member Names
ShowTitle
ShowBook
GetType
ToString
Equals
GetHashCode
.ctor
Title
Author
Price








19.2.MethodInfo
19.2.1.Get a parameterless method named MethodA for that type, and executes the method.
19.2.2.Use Reflection to get all method names
19.2.3.Use Reflection to get all member names
19.2.4.Use the DefinePInvokeMethod method to create a PInvoke method
19.2.5.Add the MethodImplAttributes.PreserveSig flag to the method implementation flags