-
-
Save gab-aquino/3865380 to your computer and use it in GitHub Desktop.
ConsoleSpinner
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static void Main(string[] args) | |
{ | |
ConsoleSpinner spin = new ConsoleSpinner(); | |
Console.Write("Working...."); | |
while (true) | |
{ | |
spin.Turn(); | |
} | |
} | |
public class ConsoleSpinner | |
{ | |
int counter; | |
public ConsoleSpiner() | |
{ | |
counter = 0; | |
} | |
public void Turn() | |
{ | |
counter++; | |
switch (counter % 4) | |
{ | |
case 0: Console.Write("/"); break; | |
case 1: Console.Write("-"); break; | |
case 2: Console.Write("\\"); break; | |
case 3: Console.Write("|"); break; | |
} | |
Console.SetCursorPosition(Console.CursorLeft - 1, Console.CursorTop); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment