Skip to content

How to get underlying numeric values from Enum values? #131

Closed

Description

@wmjordan

Please try the following code.

var s = NetJSON.NetJSON.Serialize(FileShare.Delete)

The serialization result was "Delete" (UseEnumString = true) or Delete (UseEnumString = false).
How to get 4 (the Int32 value of FileShare.Delete)?

Activity

  1. rpgmaker commented on Aug 26, 2016

    @rpgmaker
    Owner

    It is not returning the expect int value?

  2. wmjordan commented on Aug 26, 2016

    @wmjordan
    ContributorAuthor

    Nope. The UseEnumString = false configuration returns a string without quotes on my computer, with the latest version from Git.

  3. rpgmaker commented on Aug 26, 2016

    @rpgmaker
    Owner

    Ok. I will look into it.

    Thanks,

  4. rpgmaker commented on Aug 26, 2016

    @rpgmaker
    Owner

    Thanks for the find. I missed one CIL instruction :)

    Please test again. When using the UseEnumString = false, it will output the number instead of the string which is why the quote is excluded but it was buggy

  5. rpgmaker commented on Aug 26, 2016

    @rpgmaker
    Owner

    This issue is fixed. I just tested and it works fine for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions