Gra*_*ter 5 delphi delphi-10-seattle
当我尝试在类中使用数组常量时,我得到以下错误:
[dcc32 Error] TestConstants.dpr(14): E2086 Type 'TArray<T>' is not yet completely defined
当我将它用作全局常量或使用array of string而不是TArray 时,相同的代码编译得很好.有这个工作的诀窍吗?
program Project98;
{$APPTYPE CONSOLE}
{$R *.res}
uses
System.SysUtils;
type
TMyTestClass = class
strict private
const
TEST_CLASS_CONSTANT: TArray<String> = ['1','2']; // <-- Error here
TEST_CLASS_CONSTANT2: array of string = ['1','2']; // <-- No error
end;
const
TEST_GLOABL_CONSTANT: TArray<String> = ['3','4']; // <-- No error
TEST_GLOBAL_CONSTANT2: array of string = ['3','4']; // <-- No error
begin
end.
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
162 次 |
| 最近记录: |