public static string ToString(MedicationKind value) { if (value == MedicationKind.Product) { return("product"); } else if (value == MedicationKind.Package) { return("package"); } else { throw new ArgumentException("Unrecognized MedicationKind value: " + value.ToString()); } }
public static bool TryParse(string value, out MedicationKind result) { result = default(MedicationKind); if (value == "product") { result = MedicationKind.Product; } else if (value == "package") { result = MedicationKind.Package; } else { return(false); } return(true); }