In C#, you can acquire a derived class from a dynamic property the PropertyObject class returns by using the as keyword or by casting.

The following code uses a lookup string to obtain a reference to a Step object from the sequence context:

private void Example (SequenceContext contextObj)

{

PropertyObject propertyObj;

Step stepObj;

propertyObj = contextObj.AsPropertyObject();

// stepObj would be null if GetPropertyObject did not return a step

stepObj = propertyObj.GetPropertyObject("RunState.Sequence.Main[2]",0) as Step;

// C# would raise an exception if GetPropertyObject did not return a step

stepObj = (Step)propertyObj.GetPropertyObject("RunState.Sequence.Main[2]",0);

}