TParallel。& For和TParallel.For之间有区别吗? [英] Is there a difference between TParallel.&For and TParallel.For?

查看:168
本文介绍了TParallel。& For和TParallel.For之间有区别吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

TParallel。& For TParallel.For 之间是否有区别?

两者都可以在Delphi 10 Seattle中进行编译。

Both can be compiled in Delphi 10 Seattle. so which one should I stick to?

推荐答案

TParallel。& For 的方法定义code>要求&号保留保留的字(对于,为)。除非有歧义,否则在调用该方法时不需要使用它。

The method definition for TParallel.&For requires the ampersand to escape a reserved word (for). You don't need to use it when calling the method except in cases where there would be ambiguity.

例如:

 with TParallel do begin
    &For(...)  // etc 
 end;

不过,我无法想象您为什么要这么做。

I can't imagine why you would ever want to do that, however.

请注意,如果它属于您自己的类之一,则对转义方法的任何内部调用都需要与号或显式类或实例( self )标识符。

If it were in one of your own classes, mind you, any internal calls to an escaped method would require either the ampersand or an explicit class or instance (self) identifier.

TParallel 是一个密封的类,因此在这种情况下,要点很重要。您将永远不会在其中或后代类中工作。

TParallel is a sealed class, so the point is moot in this case. You will never be working within it or within a descendent class.

这篇关于TParallel。& For和TParallel.For之间有区别吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆