Итак, есть метод(че то насрал тут): static int[] SoundFourthOctave() { int[] fourthOctave = new int[] { 262, 277, 294, 311, 330, 349, 370, 392, 415, 440, 466, 494 }; Console.Beep(fourthOctave[0], 200); } C# static int[] SoundFourthOctave() { int[] fourthOctave = new int[] { 262, 277, 294, 311, 330, 349, 370, 392, 415, 440, 466, 494 }; Console.Beep(fourthOctave[0], 200); } Есть switch-case switch (music.Key) { case ConsoleKey.S: { SoundFourthOctave(); break; } case ConsoleKey.X: { SoundFourthOctave(); break; } case ConsoleKey.D: { SoundFourthOctave(); break; } C# switch (music.Key) { case ConsoleKey.S: { SoundFourthOctave(); break; } case ConsoleKey.X: { SoundFourthOctave(); break; } case ConsoleKey.D: { SoundFourthOctave(); break; } Как вывести нужный мне элемент массива вместе со звуком? То есть должно быть что-то вроде, но должен еще выводиться звук: switch (music.Key) { case ConsoleKey.S: { SoundFourthOctave(fourthOctave[0], 200); break; } case ConsoleKey.X: { SoundFourthOctave(fourthOctave[1], 200); break; } case ConsoleKey.D: { SoundFourthOctave(fourthOctave[2], 200; break; } C# switch (music.Key) { case ConsoleKey.S: { SoundFourthOctave(fourthOctave[0], 200); break; } case ConsoleKey.X: { SoundFourthOctave(fourthOctave[1], 200); break; } case ConsoleKey.D: { SoundFourthOctave(fourthOctave[2], 200; break; } Прошу не пинайте, пытался разобраться, но видимо что-то не так понял
papapahom, int[] fourthOctave = new int[] { 262, 277, 294, 311, 330, 349, 370, 392, 415, 440, 466, 494 }; void SoundFourthOctave(int index) { Console.Beep(fourthOctave[index], 200); } switch (music.Key) { case ConsoleKey.S: { SoundFourthOctave(0); break; } case ConsoleKey.X: { SoundFourthOctave(1); break; } case ConsoleKey.D: { SoundFourthOctave(2); break; } C# int[] fourthOctave = new int[] { 262, 277, 294, 311, 330, 349, 370, 392, 415, 440, 466, 494 }; void SoundFourthOctave(int index) { Console.Beep(fourthOctave[index], 200); } switch (music.Key) { case ConsoleKey.S: { SoundFourthOctave(0); break; } case ConsoleKey.X: { SoundFourthOctave(1); break; } case ConsoleKey.D: { SoundFourthOctave(2); break; }