Passing sets from delphi to C#

Hi,

I wonder, is it possible to pass sets from Delphi to C# or vice versa?

Say we have the very simple scenario of a set of enums defined in Delphi as follows:

TMyEnum = (A, B, C);
TMyEnumSet = set of TMyEnum;

Is it possible to create a hydra plugin that takes TMyEnumSet as parameter and returns it back to the Delphi host application? If so, how would the C# side look?

Best regards,
Kristofer Carlsson

I’m not sure if the automatic importer supports it, but set of TMyEnum for any enum with less than 32 members is a C# flags on the other side.

1 Like

Thanks, the Flags attribute was exactly what i needed.

To answer my last question with an example. The Delhi side would look like:

TMyEnum = (A = 1, B = 2, C = 4);
TMyEnumSet = set of TMyEnum;

And the C# side:

[Flags] 
public enum MyEnum
{ 
    A = 1,
    B = 2,
    C = 4 // continuing with 8, 16 and so on.
}