<span style="font-family:courier new,monospace">Suppose I have the following class:<br><br><span style="color:rgb(0,0,153)">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></span><br>I would like to do this:<br><span style="color:rgb(0,0,153)"><br>with MyClassInstance <span style="color:rgb(255,0,0)">as mci</span></span></span><span style="font-family:courier new,monospace"><span style="color:rgb(0,0,153)"><span style="color:rgb(255,0,0)"><span style="font-family:courier new,monospace"><span style="color:rgb(0,0,153)">, SomethingElse</span></span></span> do begin<br>
Caption := 'A new caption';<br> for i := 0 to Count - 1 do<br> <span style="color:rgb(255,0,0)">mci</span>[i] := UpperCase(<span style="color:rgb(255,0,0)">mci</span>[i]);<br>end;</span><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.<br>
</span>