How to make Delphi Prism indexed properties visible to C # when properties are not standard

I have several Delphi Prism classes with indexed properties that I use a lot on my C # web applications (we are porting a large Delphi Win32 system to ASP.Net). My problem is that C # seems to not see indexed properties unless they are the default properties for their classes. Maybe I'm doing something wrong, but I'm completely lost.

I know this question is very similar to an error report, but I need to know if anyone knows how to solve this before reporting an error.

If I have a class like this:

TMyClass = public class
private
  ...
  method get_IndexedBool(index: Integer): boolean;
  method set_IndexedBool(index: Integer; value: boolean);
public
  property IndexedBool[index: Integer]: boolean
        read get_IndexedBool
        write set_IndexedBool; default; // make IndexedBool the default property
end;

I can use this class in C # as follows:

var myObj = new TMyClass();

myObj[0] = true;

However, if TMyClass is defined as follows:

TMyClass = public class
private
  ...
  method get_IndexedBool(index: Integer): boolean;
  method set_IndexedBool(index: Integer; value: boolean);
public
  property IndexedBool[index: Integer]: boolean
        read get_IndexedBool
        write set_IndexedBool; // IndexedBool is not the default property anymore
end;

IndexedBool #. , , :

var myObj = new TMyClass();

myObj.set_IndexedBool(0, true);

, - , IndexedBool, default . , , .

?

+3
3

, # 4.0 , - , , .

, , , # Not Delphi Prism. wiki- Delphi Prism Delphi Prism vs #:

# . Delphi Prism , .

, Delphi Prism #, .

+1

, , # . # (vb.net ).

0

, . # .

0
source

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


All Articles