static void Main(string[] args) { if (args.Length == 2) { List <DenseVal> output = EvaluationSingleImage(DeviceDescriptor.DefaultDevice(), args[1]); DenseVal actualVal = null; double maxperc = 0; foreach (var item in output) { if (Convert.ToDouble(item.percent) > maxperc) { maxperc = (Convert.ToDouble(item.percent)); actualVal = item; } } if (actualVal != null) { OutputFile(args[0], actualVal.val); } else { OutputFile(args[0], "invalid"); } } else { OutputFile(args[0], "invalid params"); } }