I trying to convert from WPF combobox selected value to enumurator it return not valid cast in the runtime otherwise the string and the enum name is matched my code is
Siren.PfundMemberWebServices.Emirates EM = (Siren.PfundMemberWebServices.Emirates)cmbemirate.SelectedValue
To convert a string to an enum
you need to use Enum.Parse
Siren.PfundMemberWebServices.Emirates EM = (Siren.PfundMemberWebServices.Emirates)Enum.Parse(typeof(Siren.PfundMemberWebServices.Emirates), cmbemirate.SelectedValue);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With