c#打印程序原码
C#打印新行 (C# printing a new line)
To print a new line within the message while printing it on the console, we can use following methods,
要在控制台上打印消息时在消息中打印新行,我们可以使用以下方法,
Using \n – prints new line
使用\ n –打印新行
Using \x0A or \xA (ASCII literal of \n) – prints new line
使用\ x0A或\ xA (\ n的ASCII文字)–打印新行
Console.WriteLine() – prints new line, if we write any message in the method – it will print new line after the message, if we do not write any message – it will print a new line only.
Console.WriteLine() –如果在方法中写入任何消息,则打印新行–如果在消息中不写入任何消息,则它将在消息后打印新行–仅打印新行。
C#代码以打印新行 (C# code to print new line )
In the below example – we are printing new lines between the messages or/and after the message.
在下面的示例中,我们在消息之间或消息之后和之后打印新行。
// C# program to print a new line
using System;
using System.IO;
using System.Text;
namespace IncludeHelp
{
class Test
{
// Main Method
static void Main(string[] args)
{
//using \n
Console.WriteLine("Hello\nWorld");
//using \x0A
Console.WriteLine("Hello\x0AWorld");
Console.WriteLine();
Console.WriteLine("end of the program");
//hit ENTER to exit the program
Console.ReadLine();
}
}
}
Output
输出量
Hello
World
Hello
World
end of the program
翻译自: https://www.includehelp.com/dot-net/print-a-new-line-example-in-c-sharp.aspx
c#打印程序原码