System.Classes.TBits.Bits

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

property Bits[Index: Integer]: Boolean read GetBit write SetBit; default;

C++

__property bool Bits[int Index] = {read=GetBit, write=SetBit/*, default*/};

Properties

Type Visibility Source Unit Parent
property public
System.Classes.pas
System.Classes.hpp
System.Classes TBits

Description

Provides indexed access to the array of Boolean values that the TBits object represents.

Use Bits to read or set a particular Boolean value, as indexed by the Index parameter. If Index is not in the range from 0 to Size - 1, an EBitsError exception is raised while trying to read the storage space. Otherwise, writing an Index bigger than Size-1 extends the storage space without error.

Note: In Delphi, Bits is the default property for TBits. This means that the property name can be omitted in code. That is, the statement:

My BitsObject.Bits[0];

can be written:

My BitsObject[0];


Note: In C++, Bits can be accessed using the [] operator. Doing so, you achieve an effect similar to the one of the default property in Delphi.

See Also

Code Examples