Jump to content

Variable in enumeration

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
1 reply to this topic

#1
williamevanl

williamevanl

    Learning Programmer

  • Members
  • PipPipPip
  • 61 posts
If I'm going to pull a value from a enumeration with:

int Int_Issue = (int)Marker_Issues.ClusterNTC;


and I need to put a string variable in place of ClusterNTC, how do I do that?

#2
semprance

semprance

    Programmer

  • Members
  • PipPipPipPip
  • 126 posts
public class MyStringEnum
{
    public const String ClusterNTC = "sometext"
    public const String ClusterSomethingElse = "the next one";
    ....
}

However, you'll lose the ability to cast each item to an int identifier...