I get a compilation error
[Error 1 (PE114) Type "array[0..1] of ConsoleApplication.MyEnum" used from type "ConsoleApplication." must be public D:\PrismProjects\ConsoleApplication\ConsoleApplication\Program.pas 14 42 ConsoleApplication]
when I try to compile the following code:
namespace ConsoleApplication;
interface
type
ConsoleApp = class
public
class method Main(args: array of string);
end;
MyEnum = (F, T);
const
EnumOfBool: array[boolean] of MyEnum = [MyEnum.F, MyEnum.T];
implementation
class method ConsoleApp.Main(args: array of string);
begin
Console.WriteLine('Hello World.');
end;
end.
Where is MyEnum defined? I'm pretty sure wherever that is, it is not marked as public (as the error message suggests), but it's left on the default visibility (which is private in .NET).
Then RRUZ is correct in his comment, you should avoid global declarations. The Oxygene compiler needs to create a (invisible, auto-generated) class containing this as a static (class) member anyways because .NET does not allow for global declarations, so you should do it 'right' in the first place.