相当于c#中的换行符

unk*_*own 1 c# windows

在我的变量之后放置什么以使其Console.WriteLine ("You input Y") 出现在不同的行上?这是代码:

static void Main()
    {
        Console.WriteLine("Welcome to my bool program!");
        Console.WriteLine("Input a NON capital y or n please.");

        char Y = Console.ReadKey().KeyChar;

        if (Y == 'y')
        {
            Console.WriteLine("You input Y");
        }
        else
        {
            if (Y == 'n')
            {
                Console.WriteLine("You input N");
            }
        }

        Console.WriteLine("Press enter to exit the program, Have a good day!");
        Console.ReadLine();
    }
Run Code Online (Sandbox Code Playgroud)

谢谢!

Sap*_*pph 7

您可以使用

Environment.NewLine
Run Code Online (Sandbox Code Playgroud)

这是一个作为换行符的字符串.

或者你可以使用

Console.WriteLine()
Run Code Online (Sandbox Code Playgroud)

没有参数,如果你想要一个换行符.