小编Bal*_*ric的帖子

为什么我不能在Delphi中使用"with"?

我听过很多程序员,特别是Delphi程序员嘲笑使用'with'.

我认为它使程序运行得更快(只有一个对父对象的引用),并且如果使用得当,它更容易阅读代码(少于十几行代码并且没有嵌套).

这是一个例子:

procedure TBitmap32.FillRectS(const ARect: TRect; Value: TColor32);
begin
  with ARect do FillRectS(Left, Top, Right, Bottom, Value);
end;
Run Code Online (Sandbox Code Playgroud)

我喜欢用with.我怎么了?

delphi with-statement

20
推荐指数
6
解决办法
7538
查看次数

标签 统计

delphi ×1

with-statement ×1