First, C # code checks for a method, not a property. Secondly, C # code compares the return to null:
Public Function checkProperty(ByVal objectt As Object, ByVal propertyy As String) As Boolean
Dim type As Type = objectt.GetType
Return type.GetProperty(propertyy) IsNot Nothing
End Function
EDIT To check the fields, modify the method as follows:
Public Function checkField(ByVal objectt As Object, ByVal fieldName As String) As Boolean
Dim type As Type = objectt.GetType
Return type.GetField(fieldName) IsNot Nothing
End Function
source
share