TraceContextEventArgs TraceContextEventArgs TraceContextEventArgs TraceContextEventArgs Class

정의

TraceFinished 이벤트를 처리하는 모든 메서드에 추적 레코드 컬렉션을 제공합니다.Provides a collection of trace records to any method that handles the TraceFinished event. 이 클래스는 상속될 수 없습니다.This class cannot be inherited.

public ref class TraceContextEventArgs sealed : EventArgs
public sealed class TraceContextEventArgs : EventArgs
type TraceContextEventArgs = class
    inherit EventArgs
Public NotInheritable Class TraceContextEventArgs
Inherits EventArgs
상속
TraceContextEventArgsTraceContextEventArgsTraceContextEventArgsTraceContextEventArgs

예제

다음 코드 예제에서는 등록 하는 방법을 보여 줍니다.는 TraceContextEventHandler 처리 하는 대리자는 TraceFinished 이벤트입니다.The following code example demonstrates how you can register a TraceContextEventHandler delegate to handle the TraceFinished event. 이 예제에서는 합니다 OnTraceFinished 메서드는 컬렉션에 액세스 TraceContextRecord 를 통해 개체를 TraceRecords 속성을 반복 하 고 응답 스트림에 씁니다.In this example, the OnTraceFinished method accesses the collection of TraceContextRecord objects through the TraceRecords property, iterates through them, and writes them to the response stream.

<%@ 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);

    // Write a trace message.
    Trace.Write("Web Forms Infrastructure Methods", "USERMESSAGE: Page_Load complete.");
}
 
// 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;
        Response.Write(String.Format("trace message: {0} <BR>", r.Message));
    }
}       
</script>
<%@ 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

    ' Write a trace message.
    Trace.Write("Web Forms Infrastructure Methods", "USERMESSAGE: Page_Load complete.")
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)
        Response.Write(String.Format("trace message: {0} <BR>", r.Message))
    Next

End Sub ' OnTraceFinished
</script>

설명

TraceContextEventArgs 클래스를 사용 합니다 TraceContext 추적 정보를 추적 레코드에 대 한 액세스를 모두 제공 하는 클래스는 HTTP 요청을 처리 하는 동안 수집 됩니다.The TraceContextEventArgs class is used by the TraceContext class to provide access to trace records after all the tracing information is gathered during HTTP request processing. 처리 하는 이벤트 처리기 대리자를 추가 하 여는 TraceFinished 이벤트 레코드를 처리, 사용자의 데이터 저장소에 기록 합니다 또는 프로 파일링 도구에 대 한 입력으로 제공할 수 있습니다.By adding an event handler delegate to handle the TraceFinished event, you can process the records, record them to your own data store, or provide them as input to a profiling tool.

생성자

TraceContextEventArgs(ICollection) TraceContextEventArgs(ICollection) TraceContextEventArgs(ICollection) TraceContextEventArgs(ICollection)

제공된 추적 레코드 컬렉션을 사용하여 TraceContextEventArgs 클래스의 새 인스턴스를 초기화합니다.Initializes a new instance of the TraceContextEventArgs class, using the provided collection of trace records.

속성

TraceRecords TraceRecords TraceRecords TraceRecords

현재 요청과 관련된 TraceContextRecord 메시지 컬렉션을 가져옵니다.Gets a collection of TraceContextRecord messages that are associated with the current request.

메서드

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

지정한 개체와 현재 개체가 같은지 여부를 확인합니다.Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

기본 해시 함수로 작동합니다.Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

현재 인스턴스의 Type을 가져옵니다.Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

현재 Object의 단순 복사본을 만듭니다.Creates a shallow copy of the current Object.

(Inherited from Object)
ToString() ToString() ToString() ToString()

현재 개체를 나타내는 문자열을 반환합니다.Returns a string that represents the current object.

(Inherited from Object)

적용 대상

추가 정보