Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace textfarbe {
- class Program {
- static void Main(string[] args) {
- string[] colorNames = ConsoleColor.GetNames(typeof(ConsoleColor));
- int count = 1;
- Console.WriteLine("Bitte wählen Sie die Farbe des Spielsteins:");
- foreach (string colorName in colorNames) {
- ConsoleColor color = (ConsoleColor)Enum.Parse(typeof(ConsoleColor), colorName);
- if (color == ConsoleColor.Black) continue;
- Console.ForegroundColor = color;
- Console.WriteLine("{0,3}: {1}", count, colorName);
- Console.ResetColor();
- count++;
- }
- Console.Write("\nIhre Wahl: ");
- int chosenColor = Convert.ToInt16(Console.ReadLine());
- Console.Write("Die gewählte Farbe lautet: ");
- ConsoleColor consoleColor = (ConsoleColor)chosenColor;
- Console.WriteLine(consoleColor);
- //Console.ForegroundColor = ????? // Hier hätt ich dann gerne, die Farbe, die ausgewählt wurde!!
- //Console.Write(colorName);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement