1

I have an Enum:

 public enum SensorType
    {

        Normal ='N',

        Lunch ='C',

        ALL
    }

In my function:

private void GetData(SensorType type){

    var charValue = type.ToString(); // here I want to get the char value, not the string.
}

I want to get "N", or "C" etc. any clue?

Thanks

VAAA
  • 13,535
  • 24
  • 118
  • 230
  • Already answered here http://stackoverflow.com/questions/943398/get-int-value-from-enum – T00rk Sep 08 '14 at 21:51

1 Answers1

6

Just cast the value:

char charValue = (char)type;

FoggyDay
  • 11,247
  • 4
  • 25
  • 40