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

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

TraceContextRecord.IsWarning プロパティ

メモ : このプロパティは、.NET Framework version 2.0新しく追加されたものです。

トレース レコードが System.Web.TraceContext.Warn メソッド呼び出し関連付けられているかどうかを示す値を取得します

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

Dim instance As TraceContextRecord
Dim value As Boolean

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

プロパティ
TraceContextRecord が Warn メソッド呼び出し関連付けられている場合trueそれ以外場合false

使用例使用例

TraceContextRecordIsWarning プロパティチェックしてレコード格納されているメッセージWarn メソッドまたは Write メソッド呼び出しによって書き込まれているかどうか判断する方法次のコード例示しますトレース レコード警告メッセージ場合エラー メッセージ場合とは異なアクション実行されます。

<%@ Page language="VB" Trace="true"
 %>
<script runat="server">
' The Page_Load method.
Private Sub Page_Load(sender As
 Object, e As EventArgs)

    ' Register a handler for the TraceFinished event.
    AddHandler Trace.TraceFinished, AddressOf
 OnTraceFinished

    Try 
    Dim ae As New ArgumentException("Trace
 Test")
        Throw ae
    
    catch ioe As InvalidOperationException
        ' You can write an error trace message using the Write method.
        Trace.Write("Exception Handling", "Exception:
 Page_Load.", ioe)
    
    Catch ae As ArgumentException
        ' You can write a warning trace message using the Warn method.
        Trace.Warn("Exception Handling", "Warning:
 Page_Load.", ae)

    End Try

End Sub ' Page_Load
 
' A TraceContextEventHandler for the TraceFinished event.
Private Sub OnTraceFinished(sender As
 Object, e As TraceContextEventArgs)

    Dim r As TraceContextRecord
    Dim o As Object
    
    ' Iterate through the collection of trace records and write 
    ' them to the response stream.

    For Each o In e.TraceRecords
        r = CType(o, TraceContextRecord)
    If r.IsWarning Then
            Response.Write(String.Format("warning
 message: {0} <BR>", r.Message))
        Else
            Response.Write(String.Format("error
 message: {0} <BR>", r.Message))
        End If
    Next

End Sub    ' OnTraceFinished
</script>
<%@ Page language="c#" Trace="true" %>
<script runat="server">
void Page_Load(object sender, EventArgs e)
{
    // Register a handler for the TraceFinished event.
    Trace.TraceFinished += new 
        TraceContextEventHandler(this.OnTraceFinished);

    try {
        throw new ArgumentException("Trace Test");
    }
    catch (InvalidOperationException ioe) {    
        // You can write an error trace message using the Write method.
        Trace.Write("Exception Handling", "Exception: Page_Load.",
 ioe);
    }
    catch (ArgumentException ae) {    
        // You can write a warning trace message using the Warn method.
        Trace.Warn("Exception Handling", "Warning: Page_Load.",
 ae);
    }
}
 
// A TraceContextEventHandler for the TraceFinished event.
void OnTraceFinished(object sender, TraceContextEventArgs e)
{
    TraceContextRecord r = null;    
    
    // Iterate through the collection of trace records and write 
    // them to the response stream.
    foreach(object o in e.TraceRecords)
    { 
        r = (TraceContextRecord)o;
        if (r.IsWarning) {
            Response.Write(String.Format("warning message: {0} <BR>",
 r.Message));
        }
        else {
            Response.Write(String.Format("error message: {0} <BR>",
 r.Message));
        }

    }
}       
</script>
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



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

辞書ショートカット

すべての辞書の索引

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

   

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



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

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

©2024 GRAS Group, Inc.RSS