public static EnumValuePair getEnumValue(FixField f, string enumString) { EnumValuePair evp = null; try { Dictionary<string, string> eDict = enumMap[f]; evp = new EnumValuePair(); evp.Enum = enumString; evp.Value = eDict[enumString]; } catch (Exception e) { Console.WriteLine("getEnumValue() caught exception: " + e.Message); evp = null; } return evp; }
public static EnumValuePair[] getEnumValues(FixField f) { EnumValuePair[] enums = null; try { Dictionary<string, string> eDict = enumMap[f]; if (eDict.Count > 0) { enums = new EnumValuePair[eDict.Count]; int i = 0; foreach (KeyValuePair<string, string> kvp in eDict) { enums[i] = new EnumValuePair(); enums[i].Enum = kvp.Key; enums[i].Value = kvp.Value; ++i; } } } catch (Exception e) { Console.WriteLine("getEnumValues() caught exception: " + e.Message); } return enums; }
public static string getEnumString(FixField f, string enumValue) { string enumstr = null; Dictionary<string, string> eDict = enumMap[f]; foreach (KeyValuePair<string, string> evp in eDict) { if (evp.Value == enumValue) { enumstr = evp.Key; break; } } return enumstr; }