public bool sameCombination(KeyCombination comb) { //retuns true if all the same keys are in both combinations bool result = true; List <KeyCode> combList = comb.getKeys(); if (combList.Count == this.getKeys().Count) { //loop through all this class' keys int counter = 0; while (result && counter < this.getKeys().Count) { if (!combList.Contains(this.getKeys()[counter])) { result = false; } counter++; } } else { result = false; } return(result); }