I am looping over the properties of the current instance using Reflection, and I'm trying to determine if a property is of type Boolean. I tried many things (typeof, GetType, etc.) but I'm not getting it working. Here's my code :
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
Try using the GetType operator (as opposed to the GetType method):
If prop.PropertyType Is GetType(Boolean) Then
' Do Something if boolean
End If
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With