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)

c# enum in x++

(0) ShareShare
ReportReport
Posted on by

i have  c#  library deployed to dynamics ax .  i must pass c# method  enum  , which  is  declared in c# class .   i  am not able to  get  this done .      

AMMobile.AMMobileService.TaskType t;

TaskType is  enum ;   i  can't  set value in it .  i  have  int  values of this  enum , but i can't  convert int to c# enum too.

can you help me with this issue?

*This post is locked for comments

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

    Can you please explain what you mean by "i  am not able to  get  this done"? It's difficult to give you a solution without knowing your problem.

  • Suggested answer
    Vilmos Kintera Profile Picture
    46,149 on at

    Edit: The provided System.Text.Encoding::get_UTF8() was indeed a class and not an Enum, however, you may refer to C# Enum values in a similar fashion.

    However, the recommended solution to map your X++ int values against the Enum could still be a viable option, depending on what exactly are you trying to do. Please provide additional details.

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

    No, that's not correct. First of all, System.Text.Encoding is a class, not an enum, and UTF8 is it's a static property returning an object. It has nothing to do with enums.

    Enum values can can accessed directly via .NET Interop, eg. System.IO.FileAccess::Read.

    The conversion from int can be done by System.Enum::ToObject(), but it's not clear yet whether David really needs it.

  • Vilmos Kintera Profile Picture
    46,149 on at

    You are absolutely correct on this one, thank you for the clarification. The FileAccess::Read is a good example indeed, and we do need additional details on what the exact requirement is.

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
Priya_K Profile Picture

Priya_K 4

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#3
Ali Zaidi Profile Picture

Ali Zaidi 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans