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. java项目调用kettleJob和Trans

    1.调用本地Job和Trans 较简单不用多说没有遇到任何问题,以下是代码: import org.pentaho.di.core.KettleEnvironment; import org.pent ...

  2. LEETCODE —— Surrounded Regions

    Total Accepted: 43584 Total Submissions: 284350 Difficulty: Medium Given a 2D board containing 'X' a ...

  3. php $_SERVER中的SERVER_NAME 和HTTP_HOST的区别

    关于这个问题,搜索引擎上搜到一大片的文章,有很多问题,在这找到一篇正确的说法:http://mimiz.cn/index.php/php/php-http_host-server_name-diffe ...

  4. 中介者模式(Mediator Pattern)

    定义一个中介对象来封装系列对象之间的交互.中介者使各个对象不需要显示地相互引用,从而使其耦合性松散,而且可以独立地改变他们之间的交互. Mediator:中介者接口.在里面定义了各个同事之间相互交互所 ...

  5. kbengine0.4.20源代码分析(一)

    基于kbengine 0.4.2 MMOPG服务端是一种高品质的工程项目,品读开源的kbe是一种乐趣.本文档我带童鞋们一起领略一下.囿于我知识面和经验方面所限,文中所述之处难免有错误存在,还请读童鞋们 ...

  6. vnc--centos 7 安装和配置

    安装步骤: 1.首先试试服务器装了 VNC 没 rpm -q tigervnc tigervnc-server 没安装的话会直接出现package tigervnc is not installedp ...

  7. python logging bydate

    #!/usr/bin/env python #_*_coding:utf-8_*_ # vim : set expandtab ts=4 sw=4 sts=4 tw=100 : import logg ...

  8. Ansible Tower

    # Generated by iptables-save v1.4.7 on Tue Aug 23 04:58:34 2016 *filter :INPUT ACCEPT [0:0] :FORWARD ...

  9. JS Date当前时间:获取日期时间方法在各浏览器中的差异

    转自:http://www.feiesoft.com/00047/<script type="text/javascript"> // JS Date当前时间获取方法在 ...

  10. 如何判断exe或dll的目标平台及是否是.NET?

    1. COFF文件头中偏移0处的Machine指示目标机器类型(IMAGE_FILE_MACHINE_AMD64等),偏移18处的Characteristics位指示文件属性(IMAGE_FILE_3 ...