Imports System.Reflection
Public Class MainClass
Public Shared Sub Main()
Dim Book = New Derived()
Dim Member As MemberInfo
Console.WriteLine("Members:")
For Each Member In Book.GetType.GetMembers()
Console.WriteLine(Member.Name & " " & Member.MemberType)
Next
Dim PropertyObj As PropertyInfo
Console.WriteLine("Properties:")
For Each PropertyObj In Book.GetType.GetProperties()
Console.WriteLine(PropertyObj.Name & " " & PropertyObj.PropertyType.ToString())
Next
Dim MethodObj As MethodInfo
Console.WriteLine("Methods:")
For Each MethodObj In Book.GetType.GetMethods()
Console.WriteLine(MethodObj.Name & " " & MethodObj.ReturnType.ToString())
Next
Dim EventObj As EventInfo
Console.WriteLine("Events:")
For Each EventObj In Book.GetType.GetEvents()
Console.WriteLine(EventObj.Name & " " & EventObj.IsMulticast)
Next
Dim InterfaceObj As Type
Console.WriteLine("Events:")
For Each InterfaceObj In Book.GetType.GetInterfaces()
Console.WriteLine(InterfaceObj.Name)
Next
End Sub
End Class
Class Base
Public ProductID As String
Public Weight As Double
Private ProductPrice As Double
Public Sub New()
End Sub
Public ReadOnly Property Price() As Double
Get
Return 0
End Get
End Property
End Class
Class Derived
Inherits Base
Implements IFormattable
Public Title As String
Public Author As String
Public Publisher As String
Public Overridable Overloads Function ToString(ByVal _
Format As String, ByVal Provider As IFormatProvider) _
As String Implements IFormattable.ToString
ToString = Title
End Function
Public Sub New()
MyBase.New()
End Sub
End Class