Delphi类即使空参数列表,如何括号内完成?
- 内容介绍
- 文章标签
- 相关推荐
本文共计354个文字,预计阅读时间需要2分钟。
在Visual Studio工作数年后,我重回Delphi 2010。我希望IDE以独特方式运行:当我声明一个函数/过程时,我希望IDE能自动完成括号。例如:如果声明过程x();,我喜欢自动完成创建过程的过程。
在Visual Studio工作了几年后,我又回到了Delphi 2010.我想让IDE以不同的方式运行:当我声明一个函数/过程时,我希望IDE的自动完成遵守括号.示例:如果我声明过程x();我喜欢自动完成创建过程myobj.x();和NOT程序myobject.x;就像它一样.是的,这并不重要,但我很迂腐.有任何想法吗?
当没有参数时,Delphi不需要括号;我怀疑这是可能的.它在接口或实现中无关紧要,因为它是一个方法声明是明确的.
function TMyClass.IsDefaultPropValue: Boolean;
我可以看到在调用方法的实际代码中它在哪里重要,你想要澄清它不是变量,如
// Unit MyClass type TMyClass=class(TSomething) public function IsDefaultPropValue: Boolean; end; // In a far distant block of code in another unit that uses the above unit, using the // nasty "with" (not you, of course - one of your coworkers): with MyClassInstance do begin // More lines of code. FirstPass is a local boolean variable. if FirstPass then begin if IsDefaultPropValue then begin // More lines of code end else begin // Alternate branch of code end; end else begin if IsDefaultPropValue then //..... end; end;
在这种情况下,不清楚IsDefaultPropValue是一个函数而不是一个布尔变量,我会用它作为
if IsDefaultPropertyValue() then ... // or better yet: if MyClassInstance.IsDefaultPropValue() then ...
说清楚.
本文共计354个文字,预计阅读时间需要2分钟。
在Visual Studio工作数年后,我重回Delphi 2010。我希望IDE以独特方式运行:当我声明一个函数/过程时,我希望IDE能自动完成括号。例如:如果声明过程x();,我喜欢自动完成创建过程的过程。
在Visual Studio工作了几年后,我又回到了Delphi 2010.我想让IDE以不同的方式运行:当我声明一个函数/过程时,我希望IDE的自动完成遵守括号.示例:如果我声明过程x();我喜欢自动完成创建过程myobj.x();和NOT程序myobject.x;就像它一样.是的,这并不重要,但我很迂腐.有任何想法吗?
当没有参数时,Delphi不需要括号;我怀疑这是可能的.它在接口或实现中无关紧要,因为它是一个方法声明是明确的.
function TMyClass.IsDefaultPropValue: Boolean;
我可以看到在调用方法的实际代码中它在哪里重要,你想要澄清它不是变量,如
// Unit MyClass type TMyClass=class(TSomething) public function IsDefaultPropValue: Boolean; end; // In a far distant block of code in another unit that uses the above unit, using the // nasty "with" (not you, of course - one of your coworkers): with MyClassInstance do begin // More lines of code. FirstPass is a local boolean variable. if FirstPass then begin if IsDefaultPropValue then begin // More lines of code end else begin // Alternate branch of code end; end else begin if IsDefaultPropValue then //..... end; end;
在这种情况下,不清楚IsDefaultPropValue是一个函数而不是一个布尔变量,我会用它作为
if IsDefaultPropertyValue() then ... // or better yet: if MyClassInstance.IsDefaultPropValue() then ...
说清楚.

