Показать сообщение отдельно
Старый 22.09.2018, 08:24   #1  
Blog bot is offline
Blog bot
Участник
 
25,646 / 848 (80) +++++++
Регистрация: 28.10.2006
ievgensaxblog: MSDyn365FO. How-to pass generic types to .Net method
Источник: https://ievgensaxblog.wordpress.com/...to-net-method/
==============



There is a wonderful blog post about Generic types in X++. And as It says, the easiest way to work with generic types in X++ is to create .Net library and expose non-generic interface, because X++ compiler has lots of limitations.

However, if you really want to have some fun and stick to X++, it’s possible with a help of reflection.

Let’s say we have a C# class that accepts  List and we want to invoke it from X++:

public class Class1{ public static string myMethod(List list) { string res = string.Empty; foreach (var array in list) { foreach (string s in array) { res += s; } }return res; }}We cannot simply declare:

var stringList = new System.Collections.Generic.List();
Looks like X++ parser cannot handle “
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.