MemberInfo.DeclaringType Property gets the class that declares this member.
Imports System
Imports System.IO
Imports System.Reflection
Imports Microsoft.VisualBasic
Class Mymemberinfo
Public Shared Sub Main()
Dim MyType As Type = Type.GetType("System.IO.BufferedStream")
Dim Mymemberinfoarray As MemberInfo() = MyType.GetMembers()
Console.WriteLine(Mymemberinfoarray.Length)
Console.WriteLine(MyType.FullName)
Dim Mymemberinfo As MemberInfo
For Each Mymemberinfo In Mymemberinfoarray
Console.WriteLine("The declaring type of {0} is {1}.", Mymemberinfo.Name, Mymemberinfo.DeclaringType.ToString())
Next Mymemberinfo
End Sub
End Class
Related examples in the same category