我需要找到以下代码的等效项以在可移植库中使用:
Public Overridable Function GetPropertyValue(ByVal p_propertyName As String) As Object
Dim bf As System.Reflection.BindingFlags
bf = Reflection.BindingFlags.IgnoreCase Or Reflection.BindingFlags.Public Or Reflection.BindingFlags.Instance Or Reflection.BindingFlags.NonPublic
Dim propInfo As System.Reflection.PropertyInfo = Me.GetType().GetProperty(p_propertyName, bf)
Dim tempValue As Object = Nothing
If propInfo Is Nothing Then
Return Nothing
End If
Try
tempValue = propInfo.GetValue(Me, Nothing)
Catch ex As Exception
Errors.Add(New Warp10.Framework.BaseObjects.BaseErrorMessage(String.Format("Could not Get Value from Property {0}, Error was :{1}", p_propertyName, ex.Message), -1))
Return Nothing
End Try
Return tempValue
End Function
BindingFlags 似乎不存在。System.Reflection.PropertyInfo 是有效类型,但我不知道如何填充它。有什么建议么?