public static Object? GetProperty(
Type type,
string propertyName,
ReflectionWays way = ReflectionWays.Auto
)
Public Shared Function GetProperty (
type As Type,
propertyName As String,
Optional way As ReflectionWays = ReflectionWays.Auto
) As Object
public:
static Object^ GetProperty(
Type^ type,
String^ propertyName,
ReflectionWays way = ReflectionWays::Auto
)
static member GetProperty :
type : Type *
propertyName : string *
?way : ReflectionWays
(* Defaults:
let _way = defaultArg way ReflectionWays.Auto
*)
-> Object
propertyName can refer public and non-public properties.
If you already have a PropertyInfo instance use the GetProperty(Object, PropertyInfo, ReflectionWays, Object) method for better performance.
If you are not sure whether a property with the specified propertyName exists, then you can use the TryGetProperty methods instead.
If way is Auto, then this method uses the DynamicDelegate reflection way.