How to

declare multiline strings

Published: 15. February 2012 | Updated: 15. February 2012
License: Microsoft Public License (MS-PL)
Categories: Framework » Basics, Framework » Strings
Tags: Basics C# Text
Was this snippet helpful for you? YESYES / NONO
string text1 = "first line \n"
                + "second line";

string text2 = @"first line
                second line";

Console.WriteLine(text1);
Console.WriteLine();
Console.WriteLine(text2);
Console Output:
first line
second line

first line
                second line
Send us feedback about this snippet »



Related Snippets: