Skip to content

SetValue Method ​

Definition ​

  • Namespace: JASE
  • Assembly: JASE.ReflectionTools.dll

bool SetValue(object obj, string property, object value, bool caseSensitivePropName = null) ​

csharp
bool SetValue(object obj, string property, object value, bool caseSensitivePropName = null)

Sets the value of a specified property on the provided object using reflection. Supports nested property paths (e.g., "User.Address.Street") and automatic instantiation of null objects or arrays.

Parameters ​

NameDescription
caseSensitivePropNameIf false, performs a case-insensitive property lookup.
objThe object instance to modify.
propertyThe property name to set. Supports dotted paths to access nested properties (e.g., "User.Profile.Name").
valueThe value to assign to the property. Automatically converted if types differ.

Returns ​

True if the value was successfully assigned.