System.TObject.Disposed

De RAD Studio API Documentation
Aller à : navigation, rechercher

Delphi

property Disposed: Boolean read GetDisposed;

Propriétés

Type Visibilité  Source Unité  Parent
property protected System.pas System TObject


Description

Disposed est une propriété en lecture seule affichant l'état en cours de cet objet.

La propriété Disposed renvoie True si l'objet a été placé dans l'état Disposed en utilisant la méthode DisposeOf. Sinon, elle renvoie False.

type
  TMySimpleClass = class
  private
    //
    stringMember: String;
    constructor Create(Text: String);
    destructor Destroy;
  end;

constructor TMySimpleClass.Create(Text: String);
begin
  stringMember := Text;
end;

destructor TMySimpleClass.Destroy;
begin
  // this will be executed on calling the DisposeOf method.
end;

var
  myObject: TMySimpleClass;
begin
  myObject := TMySimpleClass.Create
    ('This is a code snippet illustrating the functionality for the DisposeOf method and Disposed property');
  if not myObject.Disposed then
    myObject.DisposeOf;
  //Starting here, the object has entered the Disposed state.
end.

Remarque : La méthode System.TObject.DisposeOf est supportée par les compilateurs mobiles Delphi. L'état Disposed n'est appliqué que pour les compilateurs utilisant le comptage de références automatique, tels que DCCIOSARM.EXE, DCCIOSARM64.EXE et DCCIOS32.EXE.

Voir aussi