About the author
Now you can declare initialized global instance variables and constants of class types in the Delphi for .NET Language! Not supported in Delphi for Win32.
WARNING! As this is undocumented, it may not be supported in future releases.
var Button: TButton = TButton.Create(nil);
Supported since Delphi 8? Tested on Delphi 2005 and Delphi 2006.
Here's a complete example.
{$APPTYPE CONSOLE}
{%DelphiDotNetAssemblyCompiler '$(SystemRoot)\microsoft.net\framework\v1.1.4322\System.Drawing.dll'}
uses SysUtils, StdCtrls;
procedure Test2;const Button1: TButton = TButton.Create(nil);var Button2: TButton = TButton.Create(nil); // This doesn't work, so don't bother.begin
end;
var Button1: TButton = TButton.Create(nil); // This works.const Button2: TButton = TButton.Create(nil);beginend.