<span style="font-family:courier new,monospace">Sorry, the email was interrupted, but sent by the phone in background...<br><br>So the decision of this "feature" is that it is not worth to add, right?<br><br>Thanks.<br>
</span><br><br><br><div class="gmail_quote">2013/3/16 Xiangrong Fang <span dir="ltr"><<a href="mailto:xrfang@gmail.com" target="_blank">xrfang@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
In my example, you can use Items[], but in my real project it is a record with <br><br><br>发送自魅族MX<br><br>-------- 原始邮件 --------<br>发件人:Sven Barth <<a href="mailto:pascaldragon@googlemail.com" target="_blank">pascaldragon@googlemail.com</a>><br>
时间:3月16日 17:12 周六<br>收件人:FPC-Pascal users discussions <<a href="mailto:fpc-pascal@lists.freepascal.org" target="_blank">fpc-pascal@lists.freepascal.org</a>><br>主题:Re: [fpc-pascal] a proposal about "with" syntax<div class="HOEnZb">
<div class="h5"><br><br><p>Am 16.03.2013 07:14 schrieb "Xiangrong Fang" <<a href="mailto:xrfang@gmail.com" target="_blank">xrfang@gmail.com</a>>:<br>
><br>
> Suppose I have the following class:<br>
><br>
> type<br>
> TMyClass = class<br>
> public<br>
> property Caption: string read FCaption write FCaption;<br>
> property Items[Index: Integer]: string read GetItem write SetItem; default;<br>
> function Count: Integer;<br>
> end;<br>
><br>
> I would like to do this:<br>
><br>
> with MyClassInstance as mci, SomethingElse do begin<br>
> Caption := 'A new caption';<br>
> for i := 0 to Count - 1 do<br>
> mci[i] := UpperCase(mci[i]);<br>
> end;<br>
><br>
> That is, to add an optional "as" clause to the with statement so that access array element in a structure is made easier.</p>
<p>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]".</p>
<p>Regards,<br>
Sven</p>
</div></div></blockquote></div><br>