Best way of storing an “array of records” at design-time

后端 未结 3 1560
独厮守ぢ
独厮守ぢ 2021-01-15 00:25

I have a set of data that I need to store at design-time to construct the contents of a group of components at run-time.

Something like this:

type
           


        
3条回答
  •  渐次进展
    2021-01-15 01:13

    You can also declare your array as consts and initialize it...

    const
      VulnerabilityData: array[Low(TVulnerability)..High(TVulnerability)] of TVulnerabilityData =
    ( 
        (Vulnerability : vVulnerability1; Name : Name1; Description : Description1;  ErrorMessage : ErrorMessage1),
        (Vulnerability : vVulnerability2; Name : Name2; Description : Description2;  ErrorMessage : ErrorMessage2),
    [...]
        (Vulnerability : vVulnerabilityX; Name : NameX; Description : DescriptionX;  ErrorMessage : ErrorMessageX)
        )
    );
    

    I don't have an IDE on this computer to double check the syntax... might be a comma or two missing. But this is how you should do it I think.

提交回复
热议问题