Reputation: 3852
The doc says dynamic arrays can be passed into a function/procedure using open array parameters.
For example, the following works, in accordance with the doc.
type
TAInteger = array of Integer;
function Work(const A: array of Integer): Integer;
begin
Result := Length(A);
end;
However, the code below complains about E2008 Incompatible types
:
type
TTest = class
private
procedure SetIntegerArray(const Value: array of Integer);
published
property Value: TAInteger write SetIntegerArray;
end;
I am confused why there is the "Incompatible types" error, and whether a property setter can use open array parameters ?
Upvotes: 1
Views: 271
Reputation: 612993
Can a property setter use open array parameter?
No.
The type of the parameter that contains the new property value must be compatible with the property's type. An open array is not a type. Your property setter must be written like this:
procedure SetIntegerArray(const Value: TAInteger);
Upvotes: 4