ConsoleTraceListener コンストラクタ ()とは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > ConsoleTraceListener コンストラクタ ()の意味・解説 

ConsoleTraceListener コンストラクタ ()

メモ : このコンストラクタは、.NET Framework version 2.0新しく追加されたものです。

標準出力ストリームへのトレース出力指定して、ConsoleTraceListener クラス新しインスタンス初期化します。

名前空間: System.Diagnostics
アセンブリ: System (system.dll 内)
構文構文

Dim instance As New ConsoleTraceListener
public ConsoleTraceListener ()
public:
ConsoleTraceListener ()
public ConsoleTraceListener ()
public function ConsoleTraceListener ()
解説解説
使用例使用例

指定されConsole 出力ストリームConsoleTraceListener オブジェクト初期化してトレース リスナ コレクション追加するコード例次に示します。このコード例は、ConsoleTraceListener クラストピック取り上げているコード例一部分です。

' Define a trace listener to direct trace output from this method
' to the console.
Dim consoleTracer As ConsoleTraceListener

' Check the command line arguments to determine which
' console stream should be used for trace output.
If (CmdArgs.Length > 0) AndAlso _
   (CmdArgs(0).ToLower.Equals("/stderr")) Then
    ' Initialize the console trace listener to write
    ' trace output to the standard error stream.
    consoleTracer = New ConsoleTraceListener(True)
Else
    ' Initialize the console trace listener to write
    ' trace output to the standard output stream.
    consoleTracer = New ConsoleTraceListener
End If
' Set the name of the trace listener, which helps identify this 
' particular instance within the trace listener collection.
consoleTracer.Name = "mainConsoleTracer"

' Write the initial trace message to the console trace listener.
consoleTracer.WriteLine(DateTime.Now.ToString() & " ["
 & _
     consoleTracer.Name & "] - Starting output to trace listener.")

' Add the new console trace listener to 
' the collection of trace listeners.
Trace.Listeners.Add(consoleTracer)
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
ConsoleTraceListener クラス
ConsoleTraceListener メンバ
System.Diagnostics 名前空間
TraceListener
DefaultTraceListener
EventLogTraceListener
TextWriterTraceListener
Console.Out
Debug
Trace

ConsoleTraceListener コンストラクタ (Boolean)

メモ : このコンストラクタは、.NET Framework version 2.0新しく追加されたものです。

トレース出力標準出力ストリームまたは標準エラー ストリーム書き込むためのオプション指定して、ConsoleTraceListener クラス新しインスタンス初期化します。

名前空間: System.Diagnostics
アセンブリ: System (system.dll 内)
構文構文

Public Sub New ( _
    useErrorStream As Boolean _
)
Dim useErrorStream As Boolean

Dim instance As New ConsoleTraceListener(useErrorStream)
public ConsoleTraceListener (
    bool useErrorStream
)
public:
ConsoleTraceListener (
    bool useErrorStream
)
public ConsoleTraceListener (
    boolean useErrorStream
)
public function ConsoleTraceListener (
    useErrorStream : boolean
)

パラメータ

useErrorStream

トレース出力およびデバッグ出力標準エラー ストリーム書き込む場合true標準出力ストリーム書き込む場合false

解説解説

このコンストラクタは、ConsoleTraceListener オブジェクト初期化してメッセージを Console.Out または Console.Error ストリーム書き込みますName プロパティは、空の文字列 ("") に初期化されます

使用例使用例

指定されConsole 出力ストリームConsoleTraceListener オブジェクト初期化してトレース リスナ コレクション追加するコード例次に示します。このコード例は、ConsoleTraceListener クラストピック取り上げているコード例一部分です。

' Define a trace listener to direct trace output from this method
' to the console.
Dim consoleTracer As ConsoleTraceListener

' Check the command line arguments to determine which
' console stream should be used for trace output.
If (CmdArgs.Length > 0) AndAlso _
   (CmdArgs(0).ToLower.Equals("/stderr")) Then
    ' Initialize the console trace listener to write
    ' trace output to the standard error stream.
    consoleTracer = New ConsoleTraceListener(True)
Else
    ' Initialize the console trace listener to write
    ' trace output to the standard output stream.
    consoleTracer = New ConsoleTraceListener
End If
' Set the name of the trace listener, which helps identify this 
' particular instance within the trace listener collection.
consoleTracer.Name = "mainConsoleTracer"

' Write the initial trace message to the console trace listener.
consoleTracer.WriteLine(DateTime.Now.ToString() & " ["
 & _
     consoleTracer.Name & "] - Starting output to trace listener.")

' Add the new console trace listener to 
' the collection of trace listeners.
Trace.Listeners.Add(consoleTracer)
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
ConsoleTraceListener クラス
ConsoleTraceListener メンバ
System.Diagnostics 名前空間
TraceListener
DefaultTraceListener
EventLogTraceListener
TextWriterTraceListener
System.Console
Debug
Trace

ConsoleTraceListener コンストラクタ

ConsoleTraceListener クラス新しインスタンス初期化します。
オーバーロードの一覧オーバーロードの一覧

参照参照

関連項目

ConsoleTraceListener クラス
ConsoleTraceListener メンバ
System.Diagnostics 名前空間
TraceListener
DefaultTraceListener
EventLogTraceListener
TextWriterTraceListener
Console.Out
Debug
Trace



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「ConsoleTraceListener コンストラクタ ()」の関連用語

ConsoleTraceListener コンストラクタ ()のお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



ConsoleTraceListener コンストラクタ ()のページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2024 Microsoft.All rights reserved.

©2024 GRAS Group, Inc.RSS