G
Gregg Teehan
Suggestions on best practive for array declare / subscript
using an enum - this is easy in Delphi / Object Pascal.
I want
private MyObjectClass [] myObjects;
myObjects = new MyObjectClass [DateTime.DayOfWeek];
myObjects [DayOfWeek.Monday] = new MyObjectClass();
myObjects [DayOfWeek.Tuesday] = new MyObjectClass();
but C# says array subscript must be int type
How best to do this.
1) what is syntax for cardinality of DayOfWeek enum?
2) what is 1st and last of enumeration?
e.g.
for (DayOfWeek index=low(DayOfWeek);
index <= high(DayOfWeek); index++)
{ . . . }
Gregg
using an enum - this is easy in Delphi / Object Pascal.
I want
private MyObjectClass [] myObjects;
myObjects = new MyObjectClass [DateTime.DayOfWeek];
myObjects [DayOfWeek.Monday] = new MyObjectClass();
myObjects [DayOfWeek.Tuesday] = new MyObjectClass();
but C# says array subscript must be int type
How best to do this.
1) what is syntax for cardinality of DayOfWeek enum?
2) what is 1st and last of enumeration?
e.g.
for (DayOfWeek index=low(DayOfWeek);
index <= high(DayOfWeek); index++)
{ . . . }
Gregg