web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Get List < T> of VS2010 in X ++

(0) ShareShare
ReportReport
Posted on by


Hello everyone,

I have a ClassLibrary Ledger which have a method:

public List<PersonEL> getData(){

...........

}

The PersonEL class have the following attributes:

public class PersonEL{

public string name {get; set;}

public int phone {get; set;}

....

}


From X ++ , I call the method getData()

How I can get all the List?

AX returns a list of type System.Collections.Generic.List`1 [Ledger.PersonEL]

I hope you can help me.

Thanks

 

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Martin Dráb Profile Picture
    237,967 Most Valuable Professional on at

    There are several solutions, but my preferred way is declaring a variable of type System.Collections.IEnumerable and assigning the return value there. Then call GetEnumerator() to get System.Collections.IEnumerator and use its MoveNext() and get_Current() methods to iterate the collection.

    You can see an example in my blog post Label ID fix.

    Nevertheless if it's your own code, you can simplify your life by not using generic types in the public interface used by AX via .NET Interop, because X++ doesn't have any support for generic types.

  • Community Member Profile Picture
    on at

    Martin , Thank you.

    It's just what I needed

  • Nirmal Raja Profile Picture
    4 on at

    Dear Martin,

    This is what exactly i want to read a List of VS2013 in X++.

    Can you please share the code where we have read the value of list, i tried but its not working,

    Your blog is also not available for now.

    Thanks in advance

  • Martin Dráb Profile Picture
    237,967 Most Valuable Professional on at

    Hi Nirmal, can you please elaborate what you've done and what "isn't working"? I can't help you unless you explain your problem.

    By the way, the blog is working now; I don't know what was wrong when you tried it.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans