Missing featues : array over enum

This is the first article in the blog comparing Delphi features to C#.
C# is a great language but is missing some incedibly useful features from Delphi.

In Delphi you can declare an enumeration as

TEnumColour = (Red, Green, Blue);

You can then declare an array over that enumeration:

TWaveLength : array[TEnumColour] of integer  = (100,200,300);

This is a very powerful technique for ensuring that an enumeration always has valid data.

I have yet to work out how to do this in C#

Leave a comment