C# Split a string into multiple lines in Visual Studio

Here is a simple example, in which we can split a string constant on multiple lines using @ operator

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;


namespace ConsoleApplication6
{
    class Program
    {
   
        static void Main(string[] args)
        {
            string str = @"coastline along the Arabian Sea 
                          and its Gulf of Oman in the south 
                         and is 'bordered by' India to the east, 
            Afghanistan to the west, Iran to the southwest, 
            and China in the far northeast, /respectively.
           It is separated narrowly// from Tajikistan 
          by Afghanistan's \\Wakhan Corridor in the 
         north-west, and also\\ shares a maritime 
                border with Oman.";

            string path = @"A:\AAA\COMSATS\current semester - Fall 2017\Modern Programming Languages\MPL-Books\tasks\20-09-2017";
            Console.WriteLine(path);
            //  Console.WriteLine(str);
        }
    }
}

 

Tags:,
2 Comments

Add a Comment

Your email address will not be published. Required fields are marked *