c# - How to use Enum.Parse in windows phone 7 in a proper way? -


i want parse data enum i'm stumbling upon problem. namely, when try code:

languages lang = enum.parse(typeof(languages), languagechooser.selecteditem, true); 

i info has invalid arguments. think there problem first 1 in every tutorial i've found first arg looks this.
or advice?

the issue second parameter, not first. languagechooser.selecteditem more returns instance of object rather string. i'm not sure type you're using languagechooser, it's hard proper fix is. of following:

// languagechooser bound ienumerable<string> var lang =      enum.parse(typeof(languages), languagechooser.selecteditem string, true);  // languagechooser bound proper tostring() implementation var lang =      enum.parse(typeof(languages), languagechooser.selecteditem.tostring(), true);  // languagechooser ienumerable<someothertype> someothertype has property // indicates language var obj = languagechooser.selecteditem someothertype; var lang = enum.parse(typeof(languages), obj.somelanguageproperty, true); 

Comments

Popular posts from this blog

javascript - How to synchronize the Three.js and HTML/SVG coordinate systems (especially w.r.t. the y-axis)? -

javascript - How do I find how many occurences are there of a highlighted string, and which occurence is it? -

java - Reading data from multiple zip files and combining them to one -