Implementing an Oxygene interface with a C# object

That’s because your interface definition is “wrong”. Unlike in Delphi, properties are first-class type member in interfaces, with their implementation (getter/setter) being an implementation detail. Your interface should declare only the properties, not the methods that will implement them:

 IInputData = interface
    property IntProperty: Integer read;
    property IndexedIntProperty[AColIndex: Integer]: Integer read;
  end;

What your declaration did was essentially a combination of three things, one of them a rather new (and cool, albeit not meant for this use) Oxygene feature:

(1) it declared two methods
(2) it declared two properties, entirely unrelated to those three methods
(3) it provided a default implementation (which is an Elements feature, so Visual C# won’t know about that) for the properties, that read them by calling the provided methods.

:slight_smile:


(as an unrelated aside, C# does not support named indexer properties — that’s a language limitation, and quite sad, yes — so those will continue to be awkward for your C# consumers).

1 Like