Environment.NewLine Propiedad
Definición
Obtiene la cadena de nueva línea definida para este entorno.Gets the newline string defined for this environment.
public:
static property System::String ^ NewLine { System::String ^ get(); };
public static string NewLine { get; }
member this.NewLine : string
Public Shared ReadOnly Property NewLine As String
Valor de propiedad
\r\n para plataformas que no son Unix o \n para plataformas UNIX.\r\n for non-Unix platforms, or \n for Unix platforms.
Ejemplos
En el ejemplo siguiente se muestran tres líneas separadas por líneas nuevas.The following example displays three lines separated by newlines.
// Sample for the Environment::NewLine property
using namespace System;
int main()
{
Console::WriteLine();
Console::WriteLine( "NewLine: {0} first line {0} second line {0} third line", Environment::NewLine );
}
/*
This example produces the following results:
NewLine:
first line
second line
third line
*/
// Sample for the Environment.NewLine property
using System;
class Sample
{
public static void Main()
{
Console.WriteLine();
Console.WriteLine("NewLine: {0} first line{0} second line{0} third line",
Environment.NewLine);
}
}
/*
This example produces the following results:
NewLine:
first line
second line
third line
*/
' Sample for the Environment.NewLine property
Class Sample
Public Shared Sub Main()
Console.WriteLine()
Console.WriteLine("NewLine: {0} first line{0} second line{0} third line", _
Environment.NewLine)
End Sub
End Class
'
'This example produces the following results:
'
'NewLine:
' first line
' second line
' third line
'
Comentarios
El valor de propiedad de NewLine es una constante personalizada específicamente para la plataforma actual y la implementación de la .NET Framework.The property value of NewLine is a constant customized specifically for the current platform and implementation of the .NET Framework. Para obtener más información acerca de los caracteres de escape en el valor de propiedad, consulte escapes de carácter.For more information about the escape characters in the property value, see Character Escapes.
La funcionalidad proporcionada por NewLine es a menudo lo que significan los términos nueva línea, avance de línea, salto de línea, retorno de carro, CRLF y fin de línea.The functionality provided by NewLine is often what is meant by the terms newline, line feed, line break, carriage return, CRLF, and end of line.
NewLine se puede usar junto con la compatibilidad de nueva línea específica del lenguaje, como los caracteres de escape ' \r ' y ' \n ' en Microsoft C# y C/C++, o vbCrLf en microsoft Visual Basic.NewLine can be used in conjunction with language-specific newline support such as the escape characters '\r' and '\n' in Microsoft C# and C/C++, or vbCrLf in Microsoft Visual Basic.
NewLine se anexa automáticamente al texto procesado por los Console.WriteLine métodos y StringBuilder.AppendLine .NewLine is automatically appended to text processed by the Console.WriteLine and StringBuilder.AppendLine methods.