2
Reply

Converting string to Enum

Sahil Dev

Sahil Dev

Jun 2 2016 8:16 AM
336

  1. public enum XX  
  2.   
  3. {  
  4.   
  5. Yes= 0;  
  6.   
  7. No=1;   
  8.   
  9.    
  10.   
  11. }   
 I have an Enum defined as above.

 
I have a string defined as;
 
string abc;
 
'abc' has a value of Fixed or Free.
 
If abc is 'Fixed' I would likes to convert to XX.Yes
If abc is 'Free' I would like to convert to XX.No
 
What is the best way to go about?
 
Please can anyone help urgently? 
 

 


Answers (2)