Props [v2.1-alpha.18+]

Enumerates the properties of a value.

For PropName , PropValue in Props(Value)

Parameters

Value

Type: Any

Any value, of any type except ComObject.

Return Value

Type: Enumerator

This function returns a new enumerator. The enumerator is typically passed directly to a for-loop, which calls the enumerator once for each iteration of the loop. Each call to the enumerator returns the next property name and/or value. The for-loop's variables correspond to the enumerator's parameters, which are:

PropName

Type: String

The property's name.

PropValue

Type: Any

The property's value.

If the property has a getter method, it is called to obtain the value (unless PropValue is omitted).

Remarks

Dynamic properties are enumerated only if a getter is defined and can be called without parameters. (Unlike OwnProps, this applies even when PropValue is omitted.) If Value is a Prototype, dynamic properties are not enumerated.

Note: Methods are dynamic properties which do not typically have a getter, so are not enumerated.

Unlike OwnProps, Props enumerates inherited properties, including typed properties.

If PropValue is specified, the enumerator attempts to call the property's getter to retrieve the value. If the getter throws an exception, it is propagated (not suppressed). The caller can continue enumeration at the next property only if it retained a reference to the enumerator (for instance, by assigning the return value of Props to a variable before passing it to For).

Although a primitive value (such as a string or integer) cannot have its own properties, it can inherit properties from the respective prototype.

The predefined __Class property created by a class definition and Any.Prototype.Base are not enumerated.

Objects, HasProp, OwnProps

Examples

Illustrates the use of this function.

for PropName, PropValue in Props(Map("Key", "Value"))
    MsgBox PropName "=" PropValue