public List <Weapon> GetWeaponCategory(Weapon.Category category) { // create list to save weapons of same category WeaponList weapons = new WeaponList(); // check each weapon for the matching category foreach (Weapon weapon in this) { if (weapon.eCategory == category) { weapons.Add(weapon); } } // return a WeaponList containing only weapons of matching category return(weapons); }