The solution that is equivalent to Python triple quotes is @
. It is possible to do it in other ways, but they are not equivalent. Only the @
, called string Verbatim has the same benefits and commitments you get with Python.
Concatenation in some cases may be optimized and end up giving in it, but do not count that it will always occur the same. The StringBuilder
is for another kind of need.
Do so:
WriteLine(@"Olá!
Como você está?");
In case you need to put something inside her you can use the interpolation:
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á?");
}
}
Behold working in the ideone. And in the .NET Fiddle. Also put on the Github for future reference.
If you can post an example of code, it would help to understand the situation. But in advance, try to use the property
Environment.NewLine
– maiconfriedel