C# Output
Now lets see how can we print or get our C# Output using simple line of code.
WriteLine() Method
To get output values or print text in C# on console , you can use the WriteLine() method:
For example let we want to print Hello world on console so what we can do just by using writeLine() method we can easily do that
Console.WriteLine("Hello World!");
Output
Hello World!
It is not necessary that we can print only HelloWorld! we can print any message that we want to print on console what we need that we have to use this WritleLine() method and write our message between the Double commas “Your Message”
Write() Method
We can also print our message on console by using Write() method, which is similar to WriteLine().The only difference is that it does not insert a new line at the end of the output:
Console.Write("Hello World! "); Console.Write("I will print on the same line.");
Output
Hello World! I will print on the same line.
Note that we add an extra space when needed (after “Hello World!” in the example above), for better readability.
If i hope you got it and if you have any problem or query i am available you can contact me or comment below i will 100% surely reply you.
Link: https://Codelikechamp.com
Medium Link: Follow me on Medium
Linkedin Link: Follow me on Linkedin