Try OpenEdge Now
skip to main content
ABL Reference
ABL Syntax Reference : DYNAMIC-PROPERTY statement
 

DYNAMIC-PROPERTY statement

Sets the value of a class property. The statement allows you to refer to a class property by providing a character expression for the property name, along with an object reference, THIS-OBJECT system reference, or the name of a class. The compiler supports both ABL user-defined types and .NET types for the object reference or class name.
At run time, the AVM:
*Determines the actual type of the object reference, if present
*Resolves the property name expression
*Validates the property data type against the type of the target and performs the assignment
Note: The DYNAMIC-PROPERTY statement also works with .NET indexed properties. Normally, ABL allows you to refer to a .NET indexed property without using the property name, but for dynamic access you must use the property name, typically Item indexed property.

Syntax

DYNAMIC PROPERTY( { object-reference | class-type-name }
, property-name [ , index ] ) = new-value
object-reference
Specifies a reference to an ABL or .NET class instance that exposes the specified property as an instance member. The compiler allows object-reference to be declared as any object type. At run time, the object type must resolve to the type that exposes the property.
class-type-name
Specifies the name of an ABL or .NET class type that defines the specified property as a static member. This is a CHARACTER expression that the AVM evaluates to the type name of a class at run time. It must only be the name of a class: interfaces are not valid.
property-name
Specifies a CHARACTER expression that evaluates to the property name at run time.
index
Specifies an integer expression for the index of the specified element. Use index to set or retrieve an individual array element. You can also operate on an entire array by removing the index the same way as you work with non-dynamic property access.
new-value
The value of any data type that can be assigned to the property.
Note: The value of new-value cannot be converted to the property's type.

See also

Assignment (=) statement, GetPropertyValue( ) method, SetPropertyValue( ) method