Indexed Property cannot Be Associated with Fields

Description

When the old syntax of describing a parameterized property is used, a class field is given after the access specifier.

Troubleshooting Tips

Class fields can be used only in description of parameterless properties. If the property is parameterized, methods need to be used as handlers.

A method that has the same number of parameters as the described property must be indicated after the Get access specifier.

A method that has one more parameters than the described property must be indicated after the Set access specifier. First parameters will match property indexes. The last parameter will contain the assigned value.

Example

Class TestClass: Object
    PropValue: String;
    
    Public Property Item(i: Integer): String Get PropValue Set PropValue;
    
End Class TestClass;

After the specified code is compiled, the following error is displayed: Indexed property cannot be associated with fields. To resolve the error, execute one of the following operations:

See also:

Compiler Messages