I have been using Delphi for a few years, now using Delphi8 and VC#. I
just had a preview on VC# 2.0.
I was wondering why there is no array property? While there is in
VB.net, Delphi.net and IL.
For example, in Delphi, I could have
tStringsObject.strings[i];
tStringsObject.values['something'];
tstringsObject.keys[b];
Array property looks like an array, but does not necessarily need data
buffers.
Array property is really handy for writing/wiring components and
wrapping classes and data.
In C#, you could only have indexer which one for one class. Now when I
port some Delphi code or Delphi 8 codes to C#, I have to change the
interfaces to methods.
I had contacted the Microsoft C# team, and they said they had chose
not to support array property long time ago. "We chose simplicity over
flexibility in this case."
I understand that properties and array properties are essentially
member functions of a class. Published properties could appear on the
object inspector for you to define a collection of items of an array
property at design time.
Without array property, I have to then write codes to initialize items
of a collection. This is not good for RAD.
I heard from a 2-day dot Net seminar, Microsoft is not worried about
its dominant position on desktop applications, Microsoft is much
concerned by Linux on the server markets. Dot Net and C# mostly focus
on server, on which RAD development is not as appeal as on desktop.
I think this is one of the key factors why MS C# team did not want to
implement array property.
Best regards
Dingdang