Einzelnen Beitrag anzeigen

Benutzerbild von Neutral General
Neutral General

Registriert seit: 16. Jan 2004
Ort: Bendorf
5.219 Beiträge
 
Delphi 10.2 Tokyo Professional
 
#5

AW: 2 StringListen try finally richtig anwenden

  Alt 27. Jun 2016, 08:35
Also hiermit kannst du nix falsch machen, aber auch ich mache das nicht immer
Delphi-Quellcode:
var
  SL1, SL2: TStringList;
begin
  SL1 := TStringList.Create;
  try
    SL2 := TStringList.Create;
    try
      // Code
    finally
      FreeAndNil(SL2);
    end;
  finally
    FreeAndNil(SL1);
  end;
end;
Michael
"Programmers talk about software development on weekends, vacations, and over meals not because they lack imagination,
but because their imagination reveals worlds that others cannot see."
  Mit Zitat antworten Zitat