B
Bob
Is this a bug? Expected behavior? Did I get the binding flags wrong?
Bob
--------------------
Imports System.Reflection
Module Main
Public Sub main()
Dim b As BindingFlags = BindingFlags.NonPublic Or _
BindingFlags.Public Or BindingFlags.Instance
GetProperties(GetType(foo), b)
GetProperties(GetType(foo2), b)
End Sub
Private Sub GetProperties(ByVal t As Type, ByVal b As BindingFlags)
Dim str As String
For Each p As PropertyInfo In t.GetProperties(b)
str &= p.Name & vbCrLf
Next
MsgBox(str)
End Sub
End Module
Public Class foo
Private _testpublic As String
Public Property testpublic() As String
Get
Return _testpublic
End Get
Set(ByVal Value As String)
_testpublic = Value
End Set
End Property
Private _testprivate As String
Private Property testprivate() As String
Get
Return _testprivate
End Get
Set(ByVal Value As String)
_testprivate = Value
End Set
End Property
End Class
Public Class foo2
Inherits foo
End Class
Bob
--------------------
Imports System.Reflection
Module Main
Public Sub main()
Dim b As BindingFlags = BindingFlags.NonPublic Or _
BindingFlags.Public Or BindingFlags.Instance
GetProperties(GetType(foo), b)
GetProperties(GetType(foo2), b)
End Sub
Private Sub GetProperties(ByVal t As Type, ByVal b As BindingFlags)
Dim str As String
For Each p As PropertyInfo In t.GetProperties(b)
str &= p.Name & vbCrLf
Next
MsgBox(str)
End Sub
End Module
Public Class foo
Private _testpublic As String
Public Property testpublic() As String
Get
Return _testpublic
End Get
Set(ByVal Value As String)
_testpublic = Value
End Set
End Property
Private _testprivate As String
Private Property testprivate() As String
Get
Return _testprivate
End Get
Set(ByVal Value As String)
_testprivate = Value
End Set
End Property
End Class
Public Class foo2
Inherits foo
End Class