Am 16.03.2013 07:14 schrieb "Xiangrong Fang" <xrf...@gmail.com>:
>
> Suppose I have the following class:
>
> type
>   TMyClass = class
>   public
>     property Caption: string read FCaption write FCaption;
>     property Items[Index: Integer]: string read GetItem write SetItem;
default;
>     function Count: Integer;
>   end;
>
> I would like to do this:
>
> with MyClassInstance as mci, SomethingElse do begin
>   Caption := 'A new caption';
>   for i := 0 to Count - 1 do
>     mci[i] := UpperCase(mci[i]);
> end;
>
> That is, to add an optional "as" clause to the with statement so that
access array element in a structure is made easier.

This was already requested multiple times and also reported on the
bugtracker... Nevertheless in your specific case you can just use
"Items[i]" instead of "mci[i]".

Regards,
Sven
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to