delphi – 即使对于空参数列表,如何使类完成包括括号?
发布时间:2020-12-15 09:11:53 所属栏目:大数据 来源:网络整理
导读:在Visual Studio工作了几年后,我又回到了Delphi 2010.我想让IDE以不同的方式运行: 当我声明一个函数/过程时,我希望IDE的自动完成遵守括号.示例:如果我声明过程x();我喜欢自动完成创建过程myobj.x();和NOT程序myobject.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 ... 说清楚. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |