private void match_Click(object sender, EventArgs e) { float bestMatchCost = float.PositiveInfinity; foreach (var template in templates) { List <StrokeMatch> match; float cost = KanjiMatcher.Match(allStrokes, template, out match); if (cost < bestMatchCost) { bestMatchCost = cost; bestMatch = match; matchedTemplate = template; } } matchQuality.Text = bestMatchCost.ToString(); }