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
  • 14,531
  • 28
  • 130
  • 253
  • 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,962
  • 4
  • 34
  • 48