Like learning C # and learning other computer languages, the goal of the first programming is to output "Hello world" in the console window. I've been in touch with C # before and tried to write a Web page in C #, but I haven't tried writing a console program in C #.
After creating a new console program, a very simple project with only one CS file appears. I typed "System.Console.WriteLine" ("Hello World") in the main function according to what the teacher said in class. , and then press CTRL + F5, which represents the Hello World interface that crosses the door of the programming.
My next goal is to familiarize myself with the methods and properties in the console class in the System namespace.
The first thing to try is the System.Console.ForegroundColor and System.Console.BackgroundColor properties that Mr. Zhang has demonstrated in class to change the font color and background color.
By experiment, the values of these two properties can affect the font color and background color of the characters that are then output in the console.
Next, I try to experiment with other properties and functions in the console class.
Beep () The computer executes the statement and makes a sound. For my laptop, this sound is emitted by the sound (with headphones on, the sound is emitted in the headset). I suspect that for a desktop computer, the beep sound should be emitted from the host.
Bufferheight
Bufferwidth These two properties are about the console buffer. I tried and did not find any effect. After checking the information online, I understand that the buffer is a storage area that has not been entered into the console. Do not do in-depth experiments.
Cancelkeypress is neither a function nor a property, try not to use.
CapsLock the value stored by this property is a Boolean value that records whether the keyboard caps lock is turned on.
Clear () performs a clear () display of all content before the console.
Cursorleft
Cursorsize
Cursortop
Cursorvisible These properties involve the cursor of the buffer. When experimenting with cursorleft, regardless of what I output on the console, the value of this property is always 0, and I guess this is because the buffer is always empty.
Equals () should be a comparison function that inherits from the base class.
Error
Inch
Out
Inputencoding
Outputencoding The first attribute experiment to get the following content
Don't quite understand what this is. The following two did not try, should be the same thing.
iserrorredirected
isinputredirected
Isoutputredirected property, which stores a Boolean value indicating whether the error output stream, standard input stream, standard output stream has changed
Keyavailable property, the input is available. The test value has been false.
Largestwindowheight
Largestwindowwidth calculates the maximum number of rows and columns that the console can have, and the Test line count is 46.
Movebufferarea () does not understand its interpretation, but involves buffers and does not know how to experiment.
Try these for the time being, and the rest will be spent.
C # Learning Record (i)