public static Format ToFormat(this string format) { try { return (Format)Enum.Parse(typeof(Format), format.ToUpper().Replace("X-", ""), true); } catch (Exception) { return Format.Other; } }