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. vs2010配置boost编程环境(照抄并简化)

    第一步:下载boost,我下载的方法是从http://www.boost.org/上找最新的下载.名字叫boost_1_50_0.7z. 第二步:在D盘(我C盘空间不大,准备出至少10G的空间吧)创建 ...

  2. 《C与指针》第十四章练习

    本章问题 1.预处理器定义了5个符号,给出了进行编译的文件名.文件行的当前行号,当前日期和时间以及编译器是否为ANSI C编译器.为每个符号举出一种可能的用途. answer:在打印错误信息时,文件名 ...

  3. sql语句 decimal(18,0)什么意思

    decimal(18,0)18是定点精度,0是小数位数.decimal(a,b)a指定指定小数点左边和右边可以存储的十进制数字的最大个数,最大精度38.b指定小数点右边可以存储的十进制数字的最大个数. ...

  4. jQuery中的map()方法

    jQuery中map()方法的使用格式为:$(selector).map(callback(index,domElement)). 将在每一个被选元素上执行map()方法中设置的回调函数,在回调函数中 ...

  5. shh简化

    对于SSH框架中部分的操作简化我分为两大类: 一:操作 1. 在SSH的struts.xml里 name="Action类_*" class="注入的实例"(同 ...

  6. (转) Artificial intelligence, revealed

    Artificial intelligence, revealed Yann LeCunJoaquin Quiñonero Candela It's 8:00 am on a Tuesday morn ...

  7. 使用vue给导航栏添加链接

    如下面的导航栏,使用vue技术给该导航栏增加链接: js代码为: navigation:function(){ new Vue({ el: '#navUl', data: { menuData:{ ' ...

  8. ubuntu下安装rpm 文件

      正想着如何把rpm package 安装到ubuntu上, 发现了这篇文章,转载一下 Ubuntu的软件包格式是deb,如果要安装rpm的包,则要先用alien把rpm转换成deb. sudo a ...

  9. unity, 按类型查找文件

  10. Ubuntu14.04用apt在线/离线安装CDH5.1.2[Apache Hadoop 2.3.0]-old

    用markdown重写,请稳步这里http://www.cnblogs.com/lion.net/p/5477899.html