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 123 views
123 views asked Nov 18, 2023 by avibootz
1 answer 134 views
134 views asked May 30, 2023 by avibootz
1 answer 173 views
173 views asked Jan 16, 2017 by avibootz
1 answer 166 views
166 views asked Oct 11, 2018 by avibootz
1 answer 237 views
237 views asked Sep 24, 2020 by avibootz
2 answers 246 views
...