unit Unit1;
interface
uses
Generics.Collections,
Generics.Defaults;
type
TLogFile =
class
private
FFileId : Integer;
FFileName:
string;
public
property FileId : Integer
read FFileId;
property FileName:
string read FFileName;
public
class function IdentityCompare(
const L, R: TLogFile ): Integer;
static;
class function NameCompare(
const L, R: TLogFile ): Integer;
static;
end;
TLogFileList =
class( TObjectList<TLogFile> )
public
constructor Create( AOwnsObjects: Boolean = True );
end;
implementation
{ TLogFile }
class function TLogFile.IdentityCompare(
const L, R: TLogFile ): Integer;
begin
Result := TComparer<Integer>.
default.Compare( L.FFileId, R.FFileId );
end;
class function TLogFile.NameCompare(
const L, R: TLogFile ): Integer;
begin
Result := TComparer<
string>.
default.Compare( L.FFileName, R.FFileName );
end;
{ TLogFileList }
constructor TLogFileList.Create;
begin
inherited Create( TComparer<TLogFile>.Construct( TLogFile.IdentityCompare ), AOwnsObjects );
end;
end.