private SoundBuffer GetRandomSound(string soundType) { if (SoundsDictionary.ContainsKey(soundType)) { Random random = new Random(); return(SoundsDictionary[soundType].ElementAt(random.Next(0, SoundsDictionary[soundType].Count)).Value); } else { throw new ArgumentException("There are no sounds of this type", "soundType"); } }
private SoundBuffer GetSound(string soundType, string name) { if (SoundsDictionary.ContainsKey(soundType)) { if (SoundsDictionary[soundType].ContainsKey(name)) { return(SoundsDictionary[soundType][name]); } else { throw new ArgumentException("Couldn not find sound with this name", "name"); } } else { throw new ArgumentException("There are no sounds of this type", "soundType"); } }