本文介绍了关于使用嵌套“与”的任何资源/教程,都将在下文中介绍。 Delphi中的声明?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正试图妥善使用delphi中的with语句。

I am trying to come to grips with using with statements in delphi properly.

总体上看,做简单的事情似乎很简单,但我有兴趣找到一些有关使用嵌套with语句的良好代码示例和/或教程。 EG

Overall it seems fairly simple to do simple things with but I am interested in finding some good code examples and/or tutorials on using nested with statements. E.G.

with object1, object2, etc... do 
  begin
  statements
  end;

我不确定以这种方式与语句一​​起使用时的优先顺序。

What I am unsure of is the order of precedence when using with statements in such a manner.

任何建议都会受到赞赏。

Any advice is appreciated.

推荐答案

我能为您提供的最佳建议是:

The best advice I can give you is:

永远不要使用。

如果您想使用

如果您想使用嵌套的方式,用锤子敲打您的手,直到欲望消失。

If you feel like using a nested with, pound your hand with a hammer until the desire goes away.

‘with’只是一个等待发生的错误。更改与其一起使用的类可以更改代码的含义。

'with' is just a bug waiting to happen. Altering classes used with it can alter the meaning of your code. It creates imprecise semantics, and that is always bad.

保存击键从来都不是使用 with的好理由。现在再进行几次击键将为您节省很多时间。

Saving keystrokes is never a good reason to use 'with'. A few more keystrokes now will save you a lot of pain later.

带应避免。

这篇关于关于使用嵌套“与”的任何资源/教程,都将在下文中介绍。 Delphi中的声明?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-30 13:51