When I run the code
Console.WriteLine(Convert.ToChar(Convert.ToByte(7)))
My computer makes a noise, I have confirmed this to work on a Windows 7 computer as well, I am using windows 10. My assumption is that it either has to do with how Unicode or the console handles this character but I'm not really certain. Any help understanding this would be greatly appreciated.
WriteLine(String, Object, Object) Writes the text representation of the specified objects, followed by the current line terminator, to the standard output stream using the specified format information. WriteLine(String)
Write is used to print data without printing the new line, while Console. WriteLine is used to print data along with printing the new line.
In Visual Studio uppermost menu choose Debug > Windows > Output. It shows all Console. WriteLine("Debug MyVariable: " + MyVariable) when you get to them.
The Console. WriteLine() method prints a new line after the text or a value. The Console. Write() method only prints the text or value without a new line.
char
7 is the BELL character. In early days, you could make the motherboard make a chime with just a key on your keyboard or a character put on the terminal.
When you output that character using a command line program, it plays that sound.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With