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 237 views
237 views asked Nov 18, 2023 by avibootz
1 answer 274 views
274 views asked Jan 16, 2017 by avibootz
1 answer 254 views
254 views asked Oct 11, 2018 by avibootz
1 answer 360 views
360 views asked Sep 24, 2020 by avibootz
...