} // !FromString() public static string EnumToString(this SupplierProductIdTypes c) { switch (c) { case SupplierProductIdTypes.BuyerSpecific: return("buyer_specific"); case SupplierProductIdTypes.EAN: return("ean"); case SupplierProductIdTypes.GTIN: return("gtin"); case SupplierProductIdTypes.SupplierSpecific: return("supplier_specific"); case SupplierProductIdTypes.UPC: return("upc"); default: return(""); } } // !ToString()
public static SupplierProductIdTypes FromString(this SupplierProductIdTypes _, string s) { s = s.ToLower().Trim(); switch (s) { case "buyer_specific": return(SupplierProductIdTypes.BuyerSpecific); case "ean": return(SupplierProductIdTypes.EAN); case "gtin": return(SupplierProductIdTypes.GTIN); case "supplier_specific": return(SupplierProductIdTypes.SupplierSpecific); case "upc": return(SupplierProductIdTypes.UPC); default: return(SupplierProductIdTypes.Unknown); } } // !FromString()