Debug.WriteLine 메서드
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
Listeners 컬렉션의 추적 수신기에 디버그에 대한 정보를 씁니다.
오버로드
WriteLine(String, String) |
Listeners 컬렉션의 추적 수신기에 범주 이름 및 메시지를 씁니다. |
WriteLine(String, Object[]) |
Listeners 컬렉션의 추적 수신기에 서식이 지정된 메시지를 쓰고 뒤에 줄 종결자를 붙입니다. |
WriteLine(String) |
Listeners 컬렉션의 추적 수신기에 메시지를 쓰고 뒤에 줄 종결자를 붙입니다. |
WriteLine(Object) |
ToString() 컬렉션의 추적 수신기에 개체의 Listeners 메서드 값을 씁니다. |
WriteLine(Object, String) |
ToString() 컬렉션의 추적 수신기에 범주 이름 및 개체의 Listeners 메서드 값을 씁니다. |
WriteLine(String, String)
- Source:
- Debug.cs
- Source:
- Debug.cs
- Source:
- Debug.cs
Listeners 컬렉션의 추적 수신기에 범주 이름 및 메시지를 씁니다.
public:
static void WriteLine(System::String ^ message, System::String ^ category);
[System.Diagnostics.Conditional("DEBUG")]
public static void WriteLine (string message, string category);
[System.Diagnostics.Conditional("DEBUG")]
public static void WriteLine (string? message, string? category);
[<System.Diagnostics.Conditional("DEBUG")>]
static member WriteLine : string * string -> unit
Public Shared Sub WriteLine (message As String, category As String)
매개 변수
- message
- String
쓸 메시지입니다.
- category
- String
출력을 구성하는 데 사용되는 범주 이름입니다.
- 특성
예제
다음 예제에서는 라는 를 TraceSwitchgeneralSwitch
만듭니다. 이 스위치는 코드 샘플 외부에서 설정됩니다.
스위치가 이상으로 설정된 TraceLevelError
경우 예제에서는 첫 번째 오류 메시지를 에 Listeners출력합니다. 컬렉션에 수신기를 추가하는 방법에 Listeners 대한 자세한 내용은 클래스를 참조하세요 TraceListenerCollection .
그런 다음 가 TraceLevel 로 Verbose
설정된 경우 예제에서는 두 번째 오류 메시지와 를 첫 번째 메시지와 category
동일한 줄에 출력합니다. 줄 종결자는 두 번째 메시지를 따릅니다.
// Class-level declaration.
// Create a TraceSwitch.
static TraceSwitch^ generalSwitch =
gcnew TraceSwitch( "General","Entire Application" );
public:
static void MyErrorMethod( String^ category )
{
// Write the message if the TraceSwitch level is set to Error or higher.
if ( generalSwitch->TraceError )
{
#if defined(DEBUG)
Debug::Write( "My error message. " );
#endif
}
// Write a second message if the TraceSwitch level is set to Verbose.
if ( generalSwitch->TraceVerbose )
{
#if defined(DEBUG)
Debug::WriteLine( "My second error message.", category );
#endif
}
}
// Class-level declaration.
// Create a TraceSwitch.
static TraceSwitch generalSwitch = new TraceSwitch("General", "Entire Application");
static public void MyErrorMethod(string category)
{
// Write the message if the TraceSwitch level is set to Error or higher.
if (generalSwitch.TraceError)
Debug.Write("My error message. ");
// Write a second message if the TraceSwitch level is set to Verbose.
if (generalSwitch.TraceVerbose)
Debug.WriteLine("My second error message.", category);
}
' Class-level declaration.
' Create a TraceSwitch.
Private Shared generalSwitch As New TraceSwitch("General", "Entire Application")
Public Shared Sub MyErrorMethod(category As String)
' Write the message if the TraceSwitch level is set to Error or higher.
If generalSwitch.TraceError Then
Debug.Write("My error message. ")
End If
' Write a second message if the TraceSwitch level is set to Verbose.
If generalSwitch.TraceVerbose Then
Debug.WriteLine("My second error message.", category)
End If
End Sub
설명
기본적으로 출력은 인스턴스 DefaultTraceListener에 기록됩니다.
매개 변수를 category
사용하여 출력 메시지를 그룹화할 수 있습니다.
이 메서드는 WriteLine 추적 수신기의 메서드를 호출합니다.
추가 정보
- Debug
- Trace
- BooleanSwitch
- TraceSwitch
- TraceListener
- DefaultTraceListener
- ConsoleTraceListener
- ConditionalAttribute
적용 대상
WriteLine(String, Object[])
- Source:
- Debug.cs
- Source:
- Debug.cs
- Source:
- Debug.cs
Listeners 컬렉션의 추적 수신기에 서식이 지정된 메시지를 쓰고 뒤에 줄 종결자를 붙입니다.
public:
static void WriteLine(System::String ^ format, ... cli::array <System::Object ^> ^ args);
[System.Diagnostics.Conditional("DEBUG")]
public static void WriteLine (string format, params object[] args);
[System.Diagnostics.Conditional("DEBUG")]
public static void WriteLine (string format, params object?[] args);
[<System.Diagnostics.Conditional("DEBUG")>]
static member WriteLine : string * obj[] -> unit
Public Shared Sub WriteLine (format As String, ParamArray args As Object())
매개 변수
- format
- String
args
배열의 개체에 해당하는 0개 이상의 형식 항목과 결합된 텍스트를 포함하는 복합 형식 문자열입니다.
- args
- Object[]
형식을 지정할 개체를 0개 이상 포함하는 개체 배열입니다.
- 특성
설명
이 메서드는 .NET 복합 서식 지정 기능을 사용하여 개체의 값을 텍스트 표현으로 변환하고 문자열에 해당 표현을 포함합니다.
이 메서드 구문의 params (C#) 또는 ParamArray (Visual Basic의 경우) 키워드는 개체 배열이 단일 값일 수 있음을 의미합니다. 이에 대한 예외는 개체입니다 String . 명시적 오버로드가 우선하므로 arg
단일 문자열의 값은 기본적으로 오버로드로 Debug.WriteLine(String, String) 설정됩니다.
기본적으로 출력은 인스턴스 DefaultTraceListener에 기록됩니다.
이 메서드는 TraceListener.WriteLine 추적 수신기의 메서드를 호출합니다.
적용 대상
WriteLine(String)
- Source:
- Debug.cs
- Source:
- Debug.cs
- Source:
- Debug.cs
Listeners 컬렉션의 추적 수신기에 메시지를 쓰고 뒤에 줄 종결자를 붙입니다.
public:
static void WriteLine(System::String ^ message);
[System.Diagnostics.Conditional("DEBUG")]
public static void WriteLine (string message);
[System.Diagnostics.Conditional("DEBUG")]
public static void WriteLine (string? message);
[<System.Diagnostics.Conditional("DEBUG")>]
static member WriteLine : string -> unit
Public Shared Sub WriteLine (message As String)
매개 변수
- message
- String
쓸 메시지입니다.
- 특성
예제
다음 예제에서는 라는 를 TraceSwitchgeneralSwitch
만듭니다. 이 스위치는 코드 샘플 외부에서 설정됩니다.
스위치가 이상으로 설정된 TraceLevelError
경우 예제에서는 첫 번째 오류 메시지를 에 Listeners출력합니다. 컬렉션에 수신기를 추가하는 방법에 Listeners 대한 자세한 내용은 클래스를 참조하세요 TraceListenerCollection .
그런 다음 이 TraceLevel 로 설정된 Verbose
경우 예제에서는 첫 번째 메시지와 동일한 줄에 두 번째 오류 메시지를 출력합니다. 줄 종결자는 두 번째 메시지를 따릅니다.
// Class-level declaration.
// Create a TraceSwitch.
static TraceSwitch^ generalSwitch =
gcnew TraceSwitch( "General","Entire Application" );
public:
static void MyErrorMethod()
{
// Write the message if the TraceSwitch level is set to Error or higher.
if ( generalSwitch->TraceError )
{
#if defined(DEBUG)
Debug::Write( "My error message. " );
#endif
}
// Write a second message if the TraceSwitch level is set to Verbose.
if ( generalSwitch->TraceVerbose )
{
#if defined(DEBUG)
Debug::WriteLine( "My second error message." );
#endif
}
}
// Class-level declaration.
// Create a TraceSwitch.
TraceSwitch generalSwitch = new TraceSwitch("General", "Entire Application");
static void MyErrorMethod()
{
// Write the message if the TraceSwitch level is set to Error or higher.
if (generalSwitch.TraceError)
Debug.Write("My error message. ");
// Write a second message if the TraceSwitch level is set to Verbose.
if (generalSwitch.TraceVerbose)
Debug.WriteLine("My second error message.");
}
' Class-level declaration.
' Create a TraceSwitch.
Private Shared generalSwitch As New TraceSwitch("General", "Entire Application")
Public Shared Sub MyErrorMethod()
' Write the message if the TraceSwitch level is set to Error or higher.
If generalSwitch.TraceError Then
Debug.Write("My error message. ")
End If
' Write a second message if the TraceSwitch level is set to Verbose.
If generalSwitch.TraceVerbose Then
Debug.WriteLine("My second error message.")
End If
End Sub
설명
기본적으로 출력은 인스턴스 DefaultTraceListener에 기록됩니다.
이 메서드는 WriteLine 추적 수신기의 메서드를 호출합니다.
추가 정보
- Debug
- Trace
- BooleanSwitch
- TraceSwitch
- TraceListener
- DefaultTraceListener
- ConsoleTraceListener
- ConditionalAttribute
적용 대상
WriteLine(Object)
- Source:
- Debug.cs
- Source:
- Debug.cs
- Source:
- Debug.cs
ToString() 컬렉션의 추적 수신기에 개체의 Listeners 메서드 값을 씁니다.
public:
static void WriteLine(System::Object ^ value);
[System.Diagnostics.Conditional("DEBUG")]
public static void WriteLine (object value);
[System.Diagnostics.Conditional("DEBUG")]
public static void WriteLine (object? value);
[<System.Diagnostics.Conditional("DEBUG")>]
static member WriteLine : obj -> unit
Public Shared Sub WriteLine (value As Object)
매개 변수
- 특성
예제
다음 예제에서는 라는 를 TraceSwitchgeneralSwitch
만듭니다. 이 스위치는 코드 샘플 외부에서 설정됩니다.
스위치가 이상으로 설정된 TraceLevelError
경우 예제에서는 첫 번째 오류 메시지를 에 Listeners출력합니다. 컬렉션에 수신기를 추가하는 방법에 Listeners 대한 자세한 내용은 클래스를 참조하세요 TraceListenerCollection .
그런 다음 이 TraceLevel 로 설정된 Verbose
경우 예제에서는 첫 번째 메시지와 동일한 줄에 개체의 이름을 출력합니다. 줄 종결자는 두 번째 메시지를 따릅니다.
// Class-level declaration.
// Create a TraceSwitch.
static TraceSwitch^ generalSwitch =
gcnew TraceSwitch( "General","Entire Application" );
public:
static void MyErrorMethod( Object^ myObject )
{
// Write the message if the TraceSwitch level is set to Error or higher.
if ( generalSwitch->TraceError )
{
#if defined(DEBUG)
Debug::Write( "Invalid object. " );
#endif
}
// Write a second message if the TraceSwitch level is set to Verbose.
if ( generalSwitch->TraceVerbose )
{
#if defined(DEBUG)
Debug::WriteLine( myObject );
#endif
}
}
// Class-level declaration.
// Create a TraceSwitch.
static TraceSwitch generalSwitch = new TraceSwitch("General", "Entire Application");
static public void MyErrorMethod(Object myObject)
{
// Write the message if the TraceSwitch level is set to Error or higher.
if (generalSwitch.TraceError)
Debug.Write("Invalid object. ");
// Write a second message if the TraceSwitch level is set to Verbose.
if (generalSwitch.TraceVerbose)
Debug.WriteLine(myObject);
}
' Class-level declaration.
' Create a TraceSwitch.
Private Shared generalSwitch As New TraceSwitch("General", "Entire Application")
Public Shared Sub MyErrorMethod(myObject As Object)
' Write the message if the TraceSwitch level is set to Error or higher.
If generalSwitch.TraceError Then
Debug.Write("Invalid object. ")
End If
' Write a second message if the TraceSwitch level is set to Verbose.
If generalSwitch.TraceVerbose Then
Debug.WriteLine(myObject)
End If
End Sub
설명
기본적으로 출력은 인스턴스 DefaultTraceListener에 기록됩니다.
이 메서드는 WriteLine 추적 수신기의 메서드를 호출합니다.
추가 정보
- Debug
- Trace
- BooleanSwitch
- TraceSwitch
- TraceListener
- DefaultTraceListener
- ConsoleTraceListener
- ConditionalAttribute
적용 대상
WriteLine(Object, String)
- Source:
- Debug.cs
- Source:
- Debug.cs
- Source:
- Debug.cs
ToString() 컬렉션의 추적 수신기에 범주 이름 및 개체의 Listeners 메서드 값을 씁니다.
public:
static void WriteLine(System::Object ^ value, System::String ^ category);
[System.Diagnostics.Conditional("DEBUG")]
public static void WriteLine (object value, string category);
[System.Diagnostics.Conditional("DEBUG")]
public static void WriteLine (object? value, string? category);
[<System.Diagnostics.Conditional("DEBUG")>]
static member WriteLine : obj * string -> unit
Public Shared Sub WriteLine (value As Object, category As String)
매개 변수
- category
- String
출력을 구성하는 데 사용되는 범주 이름입니다.
- 특성
예제
다음 예제에서는 라는 를 TraceSwitchgeneralSwitch
만듭니다. 이 스위치는 코드 샘플 외부에서 설정됩니다.
스위치가 이상으로 설정된 TraceLevelError
경우 예제에서는 첫 번째 오류 메시지를 에 Listeners출력합니다. 컬렉션에 수신기를 추가하는 방법에 Listeners 대한 자세한 내용은 클래스를 참조하세요 TraceListenerCollection .
그런 다음 이 TraceLevel 로 설정된 Verbose
경우 예제에서는 첫 번째 메시지와 동일한 줄에 두 번째 오류 메시지를 출력합니다. 두 번째 메시지 뒤에 줄 종결자가 표시됩니다.
// Class-level declaration.
// Create a TraceSwitch.
static TraceSwitch^ generalSwitch =
gcnew TraceSwitch( "General","Entire Application" );
public:
static void MyErrorMethod( Object^ myObject, String^ category )
{
// Write the message if the TraceSwitch level is set to Error or higher.
if ( generalSwitch->TraceError )
{
#if defined(DEBUG)
Debug::Write( "Invalid object for category. " );
#endif
}
// Write a second message if the TraceSwitch level is set to Verbose.
if ( generalSwitch->TraceVerbose )
{
#if defined(DEBUG)
Debug::WriteLine( myObject, category );
#endif
}
}
// Class-level declaration.
// Create a TraceSwitch.
static TraceSwitch generalSwitch = new TraceSwitch("General", "Entire Application");
static public void MyErrorMethod(Object myObject, string category)
{
// Write the message if the TraceSwitch level is set to Error or higher.
if (generalSwitch.TraceError)
Debug.Write("Invalid object for category. ");
// Write a second message if the TraceSwitch level is set to Verbose.
if (generalSwitch.TraceVerbose)
Debug.WriteLine(myObject, category);
}
' Class-level declaration.
' Create a TraceSwitch.
Private Shared generalSwitch As New TraceSwitch("General", "Entire Application")
Public Shared Sub MyErrorMethod(myObject As Object, category As String)
' Write the message if the TraceSwitch level is set to Error or higher.
If generalSwitch.TraceError Then
Debug.Write("Invalid object for category. ")
End If
' Write a second message if the TraceSwitch level is set to Verbose.
If generalSwitch.TraceVerbose Then
Debug.WriteLine(myObject, category)
End If
End Sub
설명
기본적으로 출력은 인스턴스 DefaultTraceListener에 기록됩니다.
매개 변수를 category
사용하여 출력 메시지를 그룹화할 수 있습니다.
이 메서드는 WriteLine 추적 수신기의 메서드를 호출합니다.
추가 정보
- Debug
- Trace
- BooleanSwitch
- TraceSwitch
- TraceListener
- DefaultTraceListener
- ConsoleTraceListener
- ConditionalAttribute
적용 대상
.NET
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기