- public enum XX
- {
- Yes= 0;
- No=1;
- }
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?
theLizardPosted Jun 2, 2016, 9:00 PM
{
enum xx { yes, no};
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
string s = textBox1.Text;
int x =(int) (s == "Fixed" ? xx.yes : xx.no);
}
}
Sahil DevPosted Jun 2, 2016, 9:23 AM