定义二维结构体常量数组

Implementation goes this way:

type
  TSampleEnumType = (seNone, seONE, seTWO, seTHREE, seFOUR);
  TSampleRecord = record
    SampEType: TSampleEnumType;
    iValue: integer;
  end;

const
  TConstArrayofRecord: array [0..4] TSampleRecord (
    (SampEType: seNONE; iValue: 0),
    (SampEType: seONE; iValue: 1),
    (SampEType: seTWO; iValue: 2),
    (SampEType: seTHREE; iValue: 3),
    (SampEType: seFOUR; iValue: 4),
  );

This can be very usefull when we require to maintain a constant table of mapped values.

I located the method from SysUtils.pas where type ExceptMap is a array of record TExceptRec.

原文地址:https://www.cnblogs.com/djcsch2001/p/2035700.html