AX7: HOW TO USE CLASS EXTENSION METHODS

 

To create new methods on a standard AX class without customize, follow the steps below:

Create a new “public static class” following the name pattern “YourClassName” + “_Extension”.

1
2
3
4
5
6
7
8
9
public static class MySalesLineType_Extension
{
    public static void newMethod(SalesLineType _this)
    {
        info("Do your code...");
 
        _this.canBeInvoiced(); //Use _this to call methods from the base class;
    }
}

To use the method you can simple use the “base” class and call the method, on the build the extension will be attached to the class as part of the it and can be used.

1
2
3
4
5
6
7
8
9
10
class RunnableClass1
{       
    public static void main(Args _args)
    {
        SalesLineType salesLineType = new SalesLineType();       
 
        salesLineType.newMethod(); //New method created on the extension class
    }
 
}

AX7: HOW TO USE CLASS EXTENSION METHODS的更多相关文章

  1. C# Extension Methods

    In C#, extension methods enable you to add methods to existing class without creating a new derived ...

  2. Extension Methods

    Oftentimes you’ll find yourself using classes you can’t modify. Whether they’re basic data types or ...

  3. C# -- 扩展方法的应用(Extension Methods)

    当你有下面这样一个需求的时候,扩展方法就会起到作用:在项目中,类A需要添加功能,我们想到的就是在类A中添加公共方法,这个显而易见肯定可以,但是由于某种原因,你不能修改类A本身的代码,但是确实又需要增加 ...

  4. Top useful .Net extension methods

    Special extension methods were released in C# 3.0. Developers have continuously been looking for way ...

  5. (转)C# -- 扩展方法的应用(Extension Methods)

    本文转载自:http://blog.csdn.net/zxz414644665/article/details/9793205 当你有下面这样一个需求的时候,扩展方法就会起到作用:在项目中,类A需要添 ...

  6. Extension Methods "点"函数方法 扩展方法

    原文发布时间为:2011-03-25 -- 来源于本人的百度文章 [由搬家工具导入] http://msdn.microsoft.com/en-us/library/bb383977.aspx 条件: ...

  7. Extension Methods(扩展方法)

    在 OOPL 中,有静态方法.实例方法和虚方法,如下:   public sealed class String {      public static bool  IsNullOrEmpty(st ...

  8. Extension Methods (C# Programming Guide)

    https://msdn.microsoft.com/en-us//library/bb383977.aspx private static void Dump(this ArraySegment&l ...

  9. C# Extension Methods(C#类方法扩展)

    使用Extension methods 可以在已有的类型(types)中添加方法(Methods),而无需通过增加一种新的类型或修改已有的类型. 比如说,想要给string类型增加一个PrintStr ...

随机推荐

  1. 自己瞎捣腾的Win7下Linux安装之路-----图例篇

    写在前面 网上很多这方面的教程,我也是参考他们的文章和一些书籍才弄成功.没啥创新性,只为记录下来,以供自已理解和以后复习. 所谓工欲善其事,必先利其器.俺想学习Linux,当然是要先装一个Linux( ...

  2. JavaEE视频学习

    1.实现东西应先实现静态,即使用固定的数据,比如链接数据库应先实现指定数据库如mysql的链接,成功后再向动态链接修改.方法也要这样写,一步步推进,不能一下子写出动态方法,这样很容易出错.

  3. REGEX.C GNU 提取过滤数据

    今天被@SVCHAO  勾起兴趣来了.. 有把正则表达式兴趣捡起来了,试了下notepad++基本上语法倒是没有忘记,不过如果是用在嵌入式的方案的话,似乎还是有点费劲的. 先mark一个基础语法. 单 ...

  4. JPanel

    class NewPanel extends JPanel{ public NewPanel() {} public void paintComponent(Graphics g) { int x=0 ...

  5. [课程设计]Scrum 1.6 多鱼点餐系统开发进度

    [课程设计]Scrum 1.6 多鱼点餐系统开发进度(点餐页面按钮添加&修复) 1.团队名称:重案组 2.团队目标:长期经营,积累客户充分准备,伺机而行 3.团队口号:矢志不渝,追求完美 4. ...

  6. 如何让老式浏览器支持html5新增的语义元素

    html5新增加了一些语义元素,如header, footer, nav, aritcle, aside,等等. 然而,有些老款浏览器无法识别这些元素,会把它们当成 inline 元素对待,这会导致一 ...

  7. Python之路,day7-Python基础

    os.system 输出命令结果到屏幕,返回命令执行状态os.popen("dir").read()#会保存命令的执行结果输出py2.7commandscommands.getst ...

  8. Shell编程菜鸟基础入门笔记

    Shell编程基础入门     1.shell格式:例 shell脚本开发习惯 1.指定解释器 #!/bin/bash 2.脚本开头加版权等信息如:#DATE:时间,#author(作者)#mail: ...

  9. UISegmentedControl和UIStepper的使用

    UISegmentedControl:分栏控件,常用的属性和方法是 1.tintColor:控制分栏控件的颜色风格 2.insertSegmentWithTitle(Image):插入分栏标题(图片) ...

  10. nodejs+sequelize操作mysql数据库

    前言: 本人对mysql不是很熟悉,只会命令行的简单增删改查.有些观点可能不到位请谅解. sequelize是针对node.js和io.js开发的基于ORM的框架,它支持的数据库包括:PostgreS ...