【发布时间】:2014-03-09 12:33:55
【问题描述】:
我正在使用反射循环遍历当前实例的属性,并尝试确定属性是否为Boolean 类型。我尝试了很多东西(typeof、GetType 等),但我没有让它工作。这是我的代码:
For Each prop As System.Reflection.PropertyInfo In Me.GetType.GetProperties()
If prop.PropertyType Is Boolean Then 'Not Compiling
' Do Something if boolean
End If
Next
【问题讨论】:
-
试试
If prop.PropertyType Is GetType(Boolean) Then
标签: .net vb.net reflection types