Created
August 30, 2012 14:19
-
-
Save ninnemana/3529450 to your computer and use it in GitHub Desktop.
Enum Casting from Form field
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class IndexController : Controller { | |
public void Index() { | |
string form_value = "Change"; | |
Item i = new Item(); | |
i.MaterialCode = (MatCode)Enum.Parse(typeof(MatCode), form_value); | |
} | |
} | |
public class Item { | |
public MatCode MaterialCode = new MatCode(); | |
} | |
public enum MatCode{ | |
A = "Add", | |
C = "Change" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment