Last active
October 11, 2017 22:24
-
-
Save cpereira7/4e19fd1154424d63a50f99191c13ec81 to your computer and use it in GitHub Desktop.
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
| private static string DadosInput() | |
| { | |
| ConsoleKeyInfo key; | |
| string document = ""; | |
| Console.ForegroundColor = ConsoleColor.Green; | |
| Console.Write("\nData: "); | |
| Console.ForegroundColor = ConsoleColor.White; | |
| do | |
| { | |
| key = Console.ReadKey(true); | |
| if (key.Key != ConsoleKey.Backspace && key.Key != ConsoleKey.Enter) | |
| { | |
| document += key.KeyChar; | |
| Console.Write(key.KeyChar); | |
| } | |
| else | |
| { | |
| if (key.Key == ConsoleKey.Backspace && document.Length > 0) | |
| { | |
| document = document.Substring(0, (document.Length - 1)); | |
| Console.Write("\b \b"); | |
| } | |
| } | |
| } | |
| while (key.Key != ConsoleKey.Enter); | |
| return document; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment