How to use NewLine in a string with C#

2 Answers

0 votes
using System;

namespace ConsoleApplication_C_Sharp
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = "c#" +  Environment.NewLine + "Java";

            Console.WriteLine(s);
        }
    }
}

/*
run:
  
c#
Java

*/

 



answered Jan 13, 2017 by avibootz
0 votes
using System;

namespace ConsoleApplication_C_Sharp
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = "c#" + "\r\n" + "Java";

            Console.WriteLine(s);
        }
    }
}

/*
run:
  
c#
Java

*/

 



answered Jan 13, 2017 by avibootz

Related questions

2 answers 234 views
234 views asked Nov 18, 2023 by avibootz
1 answer 219 views
219 views asked May 30, 2023 by avibootz
1 answer 272 views
272 views asked Jan 16, 2017 by avibootz
1 answer 253 views
253 views asked Oct 11, 2018 by avibootz
1 answer 359 views
359 views asked Sep 24, 2020 by avibootz
2 answers 389 views
...