public static string GetDescription(this MoveDirection moveDirection) { var fi = moveDirection.GetType().GetField(moveDirection.ToString()); return(fi.GetCustomAttributes(typeof(DescriptionAttribute), false) is DescriptionAttribute[] attributes && attributes.Length > 0 ? attributes[0].Description : null); }