Feedback

Schriftfarbe in Konsolenanwendungen, Happy Birthday

Sprache: C#

Schriftfarbe in der Console ändern über enums iterieren .net snippets zum Geburtstag gratulieren 🙂
using System;
using System.Threading;

namespace HappyBirthday
{
    class Program
    {
        static void Main(string[] args)
        {
            for (int i = 0; i < 10; i++)
            {
                foreach (ConsoleColor color in Enum.GetValues(typeof(ConsoleColor)))
                {
                    if (color == ConsoleColor.Black) continue;
                    Console.ForegroundColor = color;
                    Thread.Sleep(5 * 10);
                    Console.Clear();
                    Console.WriteLine("nnnnnntttHappy 10th birthday dotnet-snippets.de");
                }
            }
        }
    }
}
using System;
using System.Threading;

namespace HappyBirthday
{
    class Program
    {
        static void Main(string[] args)
        {
            for (int i = 0; i < 10; i++)
            {
                foreach (ConsoleColor color in Enum.GetValues(typeof(ConsoleColor)))
                {
                    if (color == ConsoleColor.Black) continue;
                    Console.ForegroundColor = color;
                    Thread.Sleep(5 * 10);
                    Console.Clear();
                    Console.WriteLine("nnnnnntttHappy 10th birthday dotnet-snippets.de");
                }
            }
        }
    }
}

3 Kommentare

  1. Wegen 10 Jahren dotnet snippets wollte ich die 10 nochmals hervorheben 🙂
    Es sollte nicht verwirren. Ich bitte um Entschuldigung 🙂