Greetings
Greetings,
I always like to write the minimum amount of posible code, that's why I hate DataSet.FieldByName('bla').AsXXX
So I came up with a helper with an indexed default property:
TDataSetHelper = class helper for TDataSet
private
function GetFieldObject(FieldName: string): TField;
public
property FieldObject[Index: string]: TField read GetFieldObject; default;
end;
And the code now becomes much more easy to write for me, ie:
DataSet['blabla'].AsString
Works as expected. However: when I debug the program, if I mouseover on that, I got nothing; if I bring up Evaluate/Modify on the expression, it shows: "Function to be called, @DispInvoke, was eliminated by linker"
The property is implemented as follows:
function TDataSetHelper.GetFieldObject(FieldName: string): TField;
begin
Result := FieldByName(FieldName);
end;
Thing is, everything works fine on runtime, but I cannot debug properly. Any thoughts?
I always like to write the minimum amount of posible code, that's why I hate DataSet.FieldByName('bla').AsXXX
So I came up with a helper with an indexed default property:
TDataSetHelper = class helper for TDataSet
private
function GetFieldObject(FieldName: string): TField;
public
property FieldObject[Index: string]: TField read GetFieldObject; default;
end;
And the code now becomes much more easy to write for me, ie:
DataSet['blabla'].AsString
Works as expected. However: when I debug the program, if I mouseover on that, I got nothing; if I bring up Evaluate/Modify on the expression, it shows: "Function to be called, @DispInvoke, was eliminated by linker"
The property is implemented as follows:
function TDataSetHelper.GetFieldObject(FieldName: string): TField;
begin
Result := FieldByName(FieldName);
end;
Thing is, everything works fine on runtime, but I cannot debug properly. Any thoughts?
Comments
Post a Comment