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.
How to free more space on your home drive by redirecting the location for SDKs in RAD Studio
Learn the command line used to compile System.pas in Delphi
A method to design records so that they're allocated on a specific byte boundary, such as 16 bytes, 512 bytes, 4096 bytes, etc.
Learn why the map is cool in Go!