I have an enum
public enum ProductionStatus {
Received = 000,
Validated = 010,
PlannedAndConverted = 020,
InProduction = 030,
QAChecked
var code = (int)ProductionStatus.Validated;
You can also convert an int to an enum value, like this:
var status = (ProductionStatus)10;
bool eq = 010 == 10;
they are actually equal
If you would like to use strings , use this method.
static string EnumToString(ProductionStatus val)
{
switch (val)
{
case ProductionStatus.Received:
return "000";
case ProductionStatus.Validated:
return "010";
case ProductionStatus.PlannedAndConverted:
return "020";
default:
return "Unknown value";
}
}