-2

I am porting some kind of code from Visual Studio to Delphi 10.

Wondering how we should translate the following construct:

public event PreviewReadyDelegate PreviewReady
    {
        add     { Scheduler.AddOrRemoveEvent(() => { _previewReady += value; }); }
        remove  { Scheduler.AddOrRemoveEvent(() => { _previewReady -= value; }); }
    }

Help appreciated.

J...
  • 30,968
  • 6
  • 66
  • 143
Marco Carboni
  • 283
  • 1
  • 12

1 Answers1

4

C# events are multicast delegates. There is no equivalent construct in the Delphi language. You would need to implement your own multicast mechanism or use an existing one from a third party library, for instance that found in spring4d.

David Heffernan
  • 601,492
  • 42
  • 1,072
  • 1,490