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 156 views
156 views asked Jan 13, 2017 by avibootz
2 answers 167 views
167 views asked Jan 13, 2017 by avibootz
1 answer 134 views
134 views asked May 30, 2023 by avibootz
1 answer 172 views
172 views asked Jan 16, 2017 by avibootz
2 answers 137 views
1 answer 175 views
2 answers 175 views
175 views asked May 4, 2021 by avibootz
...