[转]Dynamics AX and Generic collections of .Net
转自:http://blogs.msdn.com/b/emeadaxsupport/archive/2009/04/23/dynamics-ax-and-generic-collections-of-net.aspx
I'm using Dynamics AX 2009 and want to instantiate the .NET class "System.Collections.Generic.List" in X++.
Intellisense expands the class to "System.Collections.Generic.List`1" however the code cannot be compiled as the class as well as all other classes in the "System.Collections.Generic" namespace are not accepted.
Actually this type as well as every type defined in the namespace System.Collections.Generic are no regular types (are classes) but they are so called "Generics". You can see this for example when you are using a Generic in C#, where you have to specify the type of the Generic at declaration / definition (here the for example for string):
More information about .NET Generics can be found here:
Generics (C# Programming Guide)
For Dynamics AX 4.0 Generics are not supported by the X++ language. This is outlined in the Microsoft Press book "Inside Dynamics AX" on page 111: The following feature of CLR cannot be used with X++:
- Public fields (These can be accessed by using CLR reflection classes.)
- Events and delegates
- The ref parameter modifier
- The out parameter modifier
- Generics
- Inner classes
- The Container composite type
- The Array composite type
- Namespace declarations
Besides the "swapping" of the Generic collection into an own Assembly that is referenced back in to Dynamics AX, the only recommendation is to use the Non-Generic counterpart of the collection (see table below).
| Generic | Non-Generic | |
|---|---|---|
| System.Collections.Generic | System.Collections | |
| Collection<T> | CollectionBase | |
| Comparer<T> | Comparer | |
| Dictionary<K, V> | Hashtable | |
| List<T> | ArrayList | |
| Queue<T> | Queue | |
| SortedDictionary<K, V> | SortedList | |
| Stack<T> | Stack | |
| ReadOnlyCollection<T> | ReadOnlyCollectionBase |
So in our case the Non-Generic counterpart of "System.Collection.Generic.List<T>" would be "System.Collections.ArrayList".
| --author: | Alexander Lachner |
| --editor: | Alexander Lachner |
| --date: | 23/04/2009 |
[转]Dynamics AX and Generic collections of .Net的更多相关文章
- Session for SSRS Report of Microsoft Dynamics AX
Session for SSRS Report of Microsoft Dynamics AX 版权声明:本文为博主原创文章,未经博主允许不得转载. Contract •A data contrac ...
- Microsoft Dynamics AX 7 新特性探索 - Demo 部署(Part 1)
Dynamics AX 7已经发布了一段时间了,我们知道这次微软为我们带来了许多令人激动的新特性.在这个系列里,Reinhard将揭开New Dynamics AX的神秘面纱,和大家一起探索这些新的特 ...
- Dynamics AX 2012 的工业物联网解决方案
Dynamics AX 2012 的工业物联网解决方案 物联网 物联网的概念在这两年非常火,包括近期很火的共享单车初创公司--摩拜单车,在产品中运用了Azure Iot物联网技术.但是,物联网并不是一 ...
- Dynamics AX 2012 在BI分析中建立数据仓库的必要性
AX系统已有的BI分析架构 对于AX 的BI分析架构,相信大家都了解,可以看Reinhard之前的译文[译]Dynamics AX 2012 R2 BI系列-分析的架构 . AX 的BI分析架构的优势 ...
- Dynamics AX 2012 R2 业务系列-销售业务流程
在博文Dynamics AX R2 业务系列中,Reinhard对这个系列做了一个规划,下面我们就按照规划开始说业务吧. 1.销售的主要职责 其实这里说的职责主要是针对销售文员,并非整天外面满世界跑业 ...
- Dynamics AX 2012 R2 安装Reporting Services 扩展
今天Reinhard在VS中部署SSRS报表时,接到以下错误: 部署因错误而被取消.在报表服务器上,验证:-SQL Server Reporting Services 服务是否正在运行. 接着,Rei ...
- Dynamics AX 2012 R2 业务系列-采购业务流程
在博文Dynamics AX R2 业务系列中,Reinhard对这个系列做了一个规划,下面我们就按照规划开始说业务吧. 国际惯例,从采购开始. 1.采购的主要职责 简单点说,采购的主要职责,是从供应 ...
- Dynamics AX 2012 R2 业务系列
在之前的一系列博文里,Reinhard介绍了Dynamics AX Demo的安装与配置.相信同学们看完后,都已经成功拥有了一个测试环境. 众所周知的是,ERP作为一个特殊的软件系统,他有着背后的业务 ...
- Dynamics AX 2012 R2 如何处理运行时间较长的报表
当处理的数据量较多,逻辑比较复杂时,报表可能会超时.为了解决这个问题,Reinhard一直使用SrsReportDataProviderPreProcess来做预处理报表.它会在调用SSRS前,在AX ...
随机推荐
- oracle ORA-00001:违反唯一约束条件
--获取约束信息 select * from information_schema.constraint_column_usage---可以获取指定数据库中的所有约束的信息以及约束与列的对应关系 go ...
- 密码有效性验证失败。该密码不够复杂,不符合 Windows 策略要求
我在sqlserver2005中建立一个用户的时候,我的用户名和密码是一样的,它不允许我建立报“密码有效性验证失败.该密码不够复杂,不符合 Windows 策略要求”错误,我把密码改成其他一些就可以, ...
- 【Netty学习】 ChannelHandler 改动及影响
channelHandler 在Netty 4.x版本有了相当大的改动 http://netty.io/wiki/new-and-noteworthy.html 官网的更新改进说明. 以下节选官网 ...
- 第六篇 Replication:合并复制-发布
本篇文章是SQL Server Replication系列的第六篇,详细内容请参考原文. 合并复制,类似于事务复制,包括一个发布服务器,一个分发服务器和一个或多个订阅服务器.每一个发布服务器上可以定义 ...
- Java学习——对象和类
1. 入门例子 package jihite; public class Dog{ int dogage; public Dog(String name){ System.out.println(&q ...
- js markdown chart flow
http://knsv.github.io/mermaid/#example-of-a-marked-renderer
- 转:JAVA强制类型转换
object对象转换为String的一些总结 ----------------------------------------------------------------------------- ...
- C#控件:TabControl
tabcontrol在切换页面的时候经常用到 这里讲下如何让tabcontrol更好看 ref:http://blog.csdn.net/conmajia/article/details/759671 ...
- Android中异步类AsyncTask的理解
这里有两种解释的方法,各有侧重点: 第一种解释: Async Task 简介:AsyncTask的特点是任务在主线程之外运行,而回调方法是在主线程中执行,这就有效地避免了使用Handler带来的麻烦 ...
- mac office
弄了个office2016正式版的教程,大多数朋友表示搞不懂,SO重新写了个超级详细的,在不懂我也是醉了.Mac office 2016免费安装教程微软近日正式向 Office 365 订阅用户发布了 ...