Is there a difference between TParallel.&For and T

2019-02-16 18:49发布

Is there a difference between TParallel.&For and TParallel.For ?

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

1条回答
够拽才男人
2楼-- · 2019-02-16 19:24

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.

For example :

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

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

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 is a sealed class, so the point is moot in this case. You will never be working within it or within a descendent class.

查看更多
登录 后发表回答