I'm starting to learn and actively use OOP in my projects. I've found that constructions like LDevices.Devices[i]
look very cumbersome and make code hard to read.
So there's my question: is there any way to be able to make a shortcut for a field to access it like LDevices[i]
, not LDevices.Devices[i]
? Devices
is TObjectList<TDevice>
.
Structure of my object, for reference:
TDeviceStorage = class (TObject)
private
DevicesByID: TDictionary<Integer,TDevice>;
public
Devices: TObjectList<TDevice>;
Constructor Create;
Destructor Destroy; override;
procedure AddDevice(aID: Integer; aName, aShortName: String; aSubtype, aLocation: Integer; aSteamID: String);
procedure Clear();
function Count(): Integer;
function DeviceByID(aID: Integer): TDevice;
function DeviceIndex(aID: Integer): Integer;
end;