“此"与“元素"对比X ++中的关键字 [英] "this" vs. "element" keyword in X++

查看:73
本文介绍了“此"与“元素"对比X ++中的关键字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在X ++中编写代码时,有时需要引用this.functionYouWant(),有时则是element.FunctionYouWant().有时两者都在范围内.我经常尝试一种,如果我想要的功能不存在,我会尝试另一种.是否有规则说明何时使用this和何时使用element?

When writing code in X++ you sometimes need to reference this.functionYouWant() and sometimes it is element.FunctionYouWant(). Sometimes both are in scope. I often try one and if the function I want isn't there I try the other. Is there a rule that explains when to use this and when to use element?

推荐答案

this可以在任何对象中用于引用当前对象和成员方法.

this can be used in any objects to reference the current object and member methods.

MorphX表单和报表是复合对象.

MorphX forms and reports are composite objects.

在表单中,对象的集合包含在FormRun对象中.您可以使用element引用来引用外部FormRun对象中的成员.

In forms the collection of objects is contained within a FormRun object. You can reference members in the outer FormRun object by using the element reference.

如果将代码放在顶层,则thiselement之间没有功能上的区别.

If your code is placed at the top level there are no functional difference between this and element.

如果将代码放置在FormDataSource中,则this将引用数据源,而element将引用FormRun.

If your code is placed in a FormDataSource this will reference the datasource but element will reference the FormRun.

这篇关于“此"与“元素"对比X ++中的关键字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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