System.TObject.Disposed

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

property Disposed: Boolean read GetDisposed;

Properties

Type Visibility Source Unit Parent
property protected System.pas System TObject

Description

Disposed is a read-only property that shows the current state of this object.

The Disposed property returns True if the object has been disposed using the DisposeOf method. Otherwise, it returns 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.
Note: The System.TObject.DisposeOf method is supported by the Delphi mobile compilers. The Disposed state only takes effect under compilers that use Automatic Reference Counting, such as DCCIOSARM.EXE, DCCIOSARM64.EXE, and DCCIOS32.EXE.

See Also