Can a variant array have 0 elements?

A normal dynamic array supports (= nil, Length() = 0) .

However, an array of options does not support this.

I pass my data in an array variant (due to OLE / COM) and I get an error when the user defines 0 elements ...

I can use varEmpty instead of an array of length 0, but these data arrays are flexibly modified (add an element, delete an element, etc.).

How can I pass empty arrays to Variant, or do I need to use a different way?

+6
source share
1 answer

varEmpty is the right way to handle this. Of course, the code on the other side of the COM interface may not like empty arrays, but it all depends on the specific contract that you have with this interface.

+4
source

Source: https://habr.com/ru/post/900677/


All Articles