The solution that is equivalent to the triple quotation marks of Python is @
. It is possible to do it in other ways, but they are not equivalent. Only @
, called string verbatim has the same benefits and commitments as gets with Python.
The concatenation in some cases can have optimization and end up giving the same, but do not count that will always occur the same. StringBuilder
is for another type of need.
Do this:
WriteLine(@"Olá!
Como você está?");
In cases where you need to put something inside it you can use tweening :
using static System.Console;
public class Program {
public static void Main() {
var nome = "João";
WriteLine(@"Olá!
Como você está?");
WriteLine($@"Olá {nome}!
Como você está?");
}
}
See running on .NET Fiddle . And no Coding Ground . Also I put it in GitHub for future reference .