开发者

Axapta method return List<Array> , how to convert it in c#

开发者 https://www.devze.com 2023-02-06 03:47 出处:网络
I have in axapta method that return List<Array>. How can I convert it on c# side and for what ? It it possible to convert it to c# List<开发者_如何学Python;ArrayList> ? I see example for co

I have in axapta method that return List<Array>. How can I convert it on c# side and for what ? It it possible to convert it to c# List<开发者_如何学Python;ArrayList> ? I see example for container:

        ArrayList magazynierzy = new ArrayList();
        for (int i = 1; i <= axContainer.Count; i++)
        {
            magazynierzy.Add(axContainer.get_Item(1).ToString());
        }


I think there are some significant flaws with this question, but taking it that you have some external process return in list of things, they are easily turned into a list of objects. You should define or identify a class that matches the items you have returned, and create a list of these. So something like:

        List<string> magazynierzy = new List<string>();
        while(axContainer.ReadNext())
            magazynierzy.Add(axContainer.get_Item(1).ToString());
        return magazynierzy;

would give you what you need ( I don't know axapta, so I have no idea how you move through the list ). If you need more complex objects, declare a class of struct for them, with a constructor that will take an axContainer object, or a list of parameters which you can pass various get_Item(n) entries into.

0

精彩评论

暂无评论...
验证码 换一张
取 消