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