我正在使用反射(Reflection)循环遍历当前实例的属性,并尝试确定一个属性是否为 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
- Ňɏssa Pøngjǣrdenlarp