Delphi Error – E2528 Type parameters not allowed on this method

Delphi Compiler Error

E2528 Type parameters not allowed on this method

Reason for the Error & Solution

This error message occurs when you are trying to build a class by using collection style parameter. Constructors and destructors do not support parameterized methods.

{$APPTYPE CONSOLE}
type
  TFoo<T: class> = class(TObject)
    constructor CreateEx<T>; // E2528
  end;

See Also