Mega Code Archive

 
Categories / VB.Net Tutorial / Reflection
 

Use Reflection to get all method names

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("Method Names")         Dim Info As Reflection.MethodInfo         For Each Info In NetBook.GetType.GetMethods()             Console.WriteLine(Info.Name)         Next     End Sub End Module Method Names ShowTitle ShowBook GetType ToString Equals GetHashCode