How to use Environment.NewLine in C#

2 Answers

0 votes
using System;

class Program
{
    static void Main() {
        Console.WriteLine($"Line 1 {Environment.NewLine}Line 2 {Environment.NewLine}Line 3");
    }
}




/*
run:

Line 1 
Line 2 
Line 3

*/

 



answered Nov 18, 2023 by avibootz
0 votes
using System;

class Program
{
    static void Main() {
        string str = $"Line 1 {Environment.NewLine}Line 2 {Environment.NewLine}Line 3";
        
        Console.WriteLine(str);
    }
}




/*
run:

Line 1 
Line 2 
Line 3

*/

 



answered Nov 18, 2023 by avibootz

Related questions

1 answer 164 views
164 views asked Jan 13, 2017 by avibootz
2 answers 180 views
180 views asked Jan 13, 2017 by avibootz
1 answer 149 views
149 views asked May 30, 2023 by avibootz
1 answer 181 views
181 views asked Jan 16, 2017 by avibootz
2 answers 151 views
1 answer 190 views
2 answers 187 views
187 views asked May 4, 2021 by avibootz
...