public int FindCommonSwaerScore(SwearStats anotherStats) { int score = 0; foreach (var myWord in AllSwears) { if (anotherStats.AllSwears.ContainsKey(myWord.Key)) { score++; } } return(score); }
public RapperTinder(List <Rapper> rappers, Song knowSong) { this.rappers = rappers; this.knowSong = knowSong; var songSwearStats = new SwearStats(); songSwearStats.AddSwearsFrom(knowSong); Program._Form.clearList(); foreach (var rapper in rappers) { var score = rapper.FindCommonSwaerScore(songSwearStats); //Console.WriteLine(rapper.name + ": " + score + " points."); Program._Form.updateList(rapper.name + ": " + score + " points."); //MessageBox.Show(rapper.name + ": " + score + " points."); } }