Accessing Dynamic Properties in C#
- Aktualisiert2025-07-23
- 1 Minute(n) Lesezeit
In C#, you can access dynamic properties by obtaining a PropertyObject reference from the specific object reference using the AsPropertyObject method on the object. You can then use the PropertyObject interface to access custom properties of the object using a lookup string to specify the specific custom property.
The following code uses the PropertyObject.GetValString method to obtain the error message value for the current step:
private void Example (Step stepObj)
{
PropertyObject propertyObj;
String errorString;
propertyObj = stepObj.AsPropertyObject();
errorString = propertyObj.GetValString("Result.Error.Msg",0);
}