Ver Mensaje Individual
  #1  
Antiguo 18-08-2008
Avatar de roman
roman roman is offline
Moderador
 
Registrado: may 2003
Ubicación: Ciudad de México
Posts: 20.269
Reputación: 10
roman Es un diamante en brutoroman Es un diamante en brutoroman Es un diamante en bruto
try-try-finally-finally

Hola,

Varias veces he visto esta construcción:

Código Delphi [-]
try
  ObjetoA := TObjectoA.Create;
  
  try
    ObjetoB := TObjetoB.Create;
    
    { algo de código }

  finally
    ObjetoB.Free;
  end;
finally
  ObjetoA.Free;
end;

¿Por qué no simplemente poner?

Código Delphi [-]
try
  ObjetoA := TObjetoA.Create;
  ObjetoB := TObjetoB.Create;

  { algo de código }

finally
  ObjetoA.Free;
  ObjetoB.Free;
end;

// Saludos
Responder Con Cita