Cómo: Generar literales de cadena multilínea (Visual C#)

Actualización: noviembre 2007

Este ejemplo ilustra dos maneras de construir un literal de cadena multilínea.

Ejemplo

string myString1 = "This is the first line of my string.\n" +
                   "This is the second line of my string.\n" +
                   "This is the third line of the string.\n";
string myString2 = @"This is the first line of my string.
This is the second line of my string.
This is the third line of the string.";

Compilar el código

Copie el código y péguelo en el método Main de una aplicación de consola.

Vea también

Conceptos

Manual del lenguaje C#

Otros recursos

Visual C# Express