console.writeline in csharp

To print a message to the console in C#, you can use the Console.WriteLine() method. Here is an example:

main.cs
string message = "Hello, world!";
Console.WriteLine(message);
62 chars
3 lines

This will print "Hello, world!" to the console.

You can also use Console.Write() if you don't want the message to be followed by a newline character:

main.cs
string message = "Hello, world!";
Console.Write(message);
58 chars
3 lines

This will print "Hello, world!" to the console without a newline character.

gistlibby LogSnag