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. UVa 12118 检查员的难题(dfs+欧拉回路)

    https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem& ...

  2. eclipse连接mysql,插入数据时乱码

    问题:如果eclipse中项目的编码方式为utf-8 插入数据后,在数据库中查看后,汉字出现乱码情况 解决方法: 1.在获取连接的时候将conn = DriverManager.getConnecti ...

  3. operating system

    一.对于子进程,系统调用fork()的返回值为0:而对于父进程,返回值为子进程的进程标识符

  4. Linear Algebra lecture7 note

    Computing the nullspace (Ax=0) Pivot variables-free variables Special solutions: rref( A)=R   rank o ...

  5. Zookeeper 的学习与运用

    引子 云计算越来越流行的今天,单一机器处理能力已经不能满足我们的需求,不得不采用大量的服务集群.服务集群对外提供服务的过程中,有很多的配置需要随时更新,服务间需要协调工作,这些信息如何推送到各个节点? ...

  6. compile vim with lua & python support

    vim在macosx 10.9默认没有带lua和python支持,因为装的有些插件是lua写的,有些是python写的,运行不起来,于是决定自己编译一个,下载vim源码,执行以下命令就可以编译vim: ...

  7. 嵌入式系统上实现GPS全球定位功能

    GPS(Global Positioning System)即全球定位系统,是由美国建立的一个卫星导航定位系统,利用该系统,用户可以在全球范围内实现全天候.连续.实时的三维导航定位和测速:另外,利用该 ...

  8. 空的安卓工程添加activity

    1.编写类继承activity,并重写onCreate方法 package org.tonny; import android.app.Activity; import android.os.Bund ...

  9. Changing SID Server 2012

    Changing SID Server 2012  Windows Server > Windows Server 2012 General Question 0 Sign in to vote ...

  10. jQuery中,$('#main') 与 document.getElementById('main')是什么样的关系-转

    $('#main')[0]和document.getElementById('main')两个一模一样.解释:$('#main'):是一个jquery写法,#main是一个过滤器表示方法,表示查找一个 ...