更新 : 2007 年 11 月
名前空間 :
System
アセンブリ :
mscorlib (mscorlib.dll 内)
Public Shared ReadOnly Property NewLine As String
Dim value As String
value = Environment.NewLine
public static string NewLine { get; }
public:
static property String^ NewLine {
String^ get ();
}
/** @property */
public static String get_NewLine()
public static function get NewLine () : String
プロパティ値
型 :
System..::.String
UNIX 以外のプラットフォームでは "\r\n" を含む文字列。
または
UNIX プラットフォームでは "\n" を含む文字列。
NewLine プロパティの値には、使用しているプラットフォームおよび .NET Framework の実装に応じて決まった値が格納されます。プロパティ値におけるエスケープ文字の詳細については、「文字のエスケープ」を参照してください。
NewLine は、改行 (Newline)、ライン フィード (Line Feed)、改行 (Line Break)、復帰 (Carriage Return)、CRLF、行末 (End Of Line) などの用語で表される機能を提供します。
NewLine と、言語に固有の改行機能 (Microsoft C#/C/C++ では '\r' や '\n' などのエスケープ文字、Microsoft Visual Basic では vbCrLf) とを組み合わせて使用することもできます。
Console..::.WriteLine メソッドおよび StringBuilder..::.AppendLine メソッドによって処理されたテキストの最後には、NewLine が自動的に付加されます。
3 つの行を改行で区切って表示するコード例を次に示します。
' Sample for the Environment.NewLine property
Imports System
Class Sample
Public Shared Sub Main()
Console.WriteLine()
Console.WriteLine("NewLine: {0} first line{0} second line{0} third line", _
Environment.NewLine)
End Sub 'Main
End Class 'Sample
'
'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
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
import System.*;
class Sample
{
public static void main(String[] args)
{
Console.WriteLine();
Console.WriteLine("NewLine: {0} first line{0} second line{0}"
+ " third line", Environment.get_NewLine());
} //main
} //Sample
/*
This example produces the following results:
NewLine:
first line
second line
third line
*/
Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98, Windows CE, Windows Mobile for Smartphone, Windows Mobile for Pocket PC
.NET Framework および .NET Compact Framework では、各プラットフォームのすべてのバージョンはサポートしていません。サポートされているバージョンについては、「.NET Framework システム要件」を参照してください。
.NET Framework
サポート対象 : 3.5、3.0、2.0、1.1、1.0
.NET Compact Framework
サポート対象 : 3.5
参照