Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Catalog · How the catalog works

Random project

managed-stringlist

RAD Studio 10.4 Sydney - Managed Records Demo

View on GitHub

Anyone may press Interesting, signed in or not. It helps others find this project.

Member rating

No ratings yet.

Sign in to rate this project.

README

TManagedStrings

RAD Studio 10.4 Sydney - Custom Managed Records - Demo

Demo of a usage new features of the recodds in RAD Studio 10.4 Sydney

  1. Delphi record type now supports custom initialization, finalization, and copy operations
  2. Customise how records get created, copied, and destroyed, by writing the code to be executed at the various steps
  3. This adds additional power to records in Delphi, a construct used to achieve better efficiency compared to classes
pascal
type
  TManagedStrings = record
  private
    fStringList: TStringList;
    procedure ClearObjects();
    procedure ZeroObjects();
  public
    class operator Initialize(out Dest: TManagedStrings);
    class operator Finalize(var Dest: TManagedStrings);
    class operator Assign(var Dest: TManagedStrings;
      const [ref] Src: TManagedStrings);
  end;