TraceSwitch.TraceInfo プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > TraceSwitch.TraceInfo プロパティの意味・解説 

TraceSwitch.TraceInfo プロパティ

スイッチ情報メッセージ許可するかどうかを示す値を取得します

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

Dim instance As TraceSwitch
Dim value As Boolean

value = instance.TraceInfo
public bool TraceInfo { get;
 }
public:
property bool TraceInfo {
    bool get ();
}
/** @property */
public boolean get_TraceInfo ()

プロパティ
Level プロパティが TraceLevel.Info または TraceLevel.Verbose に設定されている場合は、trueそれ以外場合false

解説解説

TraceError、TraceWarning、TraceInfo、および TraceVerbose の各プロパティDebug クラスおよび Trace クラス組み合わせて使用することによって、指定した重要度上のすべてのメッセージ出力できますLevel プロパティが TraceLevel.Warning に設定されている場合は、情報メッセージ警告、およびエラー処理メッセージ出力されます。

使用例使用例

新しい TraceSwitch を作成しスイッチ使用してエラー メッセージ出力するかどうか決定するコード例次に示しますスイッチクラス レベル作成されます。MyMethod は、Level プロパティTraceLevel.Info 以上に設定されている場合最初エラー メッセージ書き込みます。ただし、MyMethod は、LevelTraceLevel.Verbose 未満場合は第 2 のエラー メッセージ書き込みません。

' Class-level declaration.
' Create a TraceSwitch to use in the entire application. 
Private Shared mySwitch As
 New TraceSwitch("General", "Entire
 Application")
   
Public Shared Sub MyMethod()
    ' Write the message if the TraceSwitch level is set to Info or higher.
    If mySwitch.TraceInfo Then
        Console.WriteLine("My error message.")
    End If 
    ' Write the message if the TraceSwitch level is set to Verbose.
    If mySwitch.TraceVerbose Then
        Console.WriteLine("My second error message.")
    End If
End Sub

Public Shared Sub Main()
    ' Run the method that prints error messages based on the switch
 level.
    MyMethod()
End Sub

//Class-level declaration.
 /* Create a TraceSwitch to use in the entire application.*/
 static TraceSwitch mySwitch = new TraceSwitch("General",
 "Entire Application");
 
 static public void MyMethod()
 {
    // Write the message if the TraceSwitch level is set to Info or
 higher.
    if(mySwitch.TraceInfo)
       Console.WriteLine("My error message.");
 
    // Write the message if the TraceSwitch level is set to Verbose.
    if(mySwitch.TraceVerbose)
       Console.WriteLine("My second error message.");
 }
 
 public static void Main(string[]
 args) {
    // Run the method that prints error messages based on the switch
 level.
    MyMethod();
 }
 
   // Class-level declaration.
   /* Create a TraceSwitch to use in the entire application.*/
private:
   static TraceSwitch^ mySwitch = gcnew TraceSwitch( "General",
 "Entire Application" );

public:
   static void MyMethod()
   {
      // Write the message if the TraceSwitch level is set to Info or
 higher.
      if ( mySwitch->TraceInfo )
         Console::WriteLine( "My error message." );

      // Write the message if the TraceSwitch level is set to Verbose.
      if ( mySwitch->TraceVerbose )
         Console::WriteLine( "My second error message." );
   }

   static void main()
   {
      // Run the method that prints error messages based on the switch
 level.
      MyMethod();
   }
// Class-level declaration.
/* Create a TraceSwitch to use in the entire application.
 */
private static TraceSwitch mySwitch = 
    new TraceSwitch("General", "Entire Application");

public static void MyMethod()
{
    // Write the message if the TraceSwitch level is set to Info or
 higher.
    if (mySwitch.get_TraceInfo()) {
        Console.WriteLine("My error message.");
    }

    // Write the message if the TraceSwitch level is set to Verbose.
    if (mySwitch.get_TraceVerbose()) {
        Console.WriteLine("My second error message.");
    }
} //MyMethod

public static void main(String[]
 args)
{
    // Run the method that prints error messages based on the switch
 level.
    MyMethod();
} //main
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



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

辞書ショートカット

すべての辞書の索引

TraceSwitch.TraceInfo プロパティのお隣キーワード
検索ランキング

   

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



TraceSwitch.TraceInfo プロパティのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2024 GRAS Group, Inc.RSS