Szerkesztés

Megosztás a következőn keresztül:


EventAttribute.Task Property

Definition

Gets or sets the task for the event.

public:
 property System::Diagnostics::Tracing::EventTask Task { System::Diagnostics::Tracing::EventTask get(); void set(System::Diagnostics::Tracing::EventTask value); };
public System.Diagnostics.Tracing.EventTask Task { get; set; }
member this.Task : System.Diagnostics.Tracing.EventTask with get, set
Public Property Task As EventTask

Property Value

The task for the event.

Examples

The following example shows how to use the Task property to define event tasks. This code example is part of a larger example provided for the EventSource class.

public static class Tasks
{
    public const EventTask Page = (EventTask)1;
    public const EventTask DBQuery = (EventTask)2;
}
Public Class Tasks
    Public Const Page As EventTask = CType(1, EventTask)
    Public Const DBQuery As EventTask = CType(1, EventTask)
End Class
[Event(4, Opcode = EventOpcode.Stop, Task = Tasks.Page, Keywords = Keywords.Page, Level = EventLevel.Informational)]
public void PageStop(int ID) { if (IsEnabled()) WriteEvent(4, ID); }
<[Event](4, Opcode:=EventOpcode.Stop, Task:=Tasks.Page, Keywords:=Keywords.Page, Level:=EventLevel.Informational)> _
Public Sub PageStop(ByVal ID As Integer)
    If IsEnabled() Then
        WriteEvent(4, ID)
    End If
End Sub
[Event(5, Opcode = EventOpcode.Start, Task = Tasks.DBQuery, Keywords = Keywords.DataBase, Level = EventLevel.Informational)]
public void DBQueryStart(string sqlQuery) { WriteEvent(5, sqlQuery); }
<[Event](5, Opcode:=EventOpcode.Start, Task:=Tasks.DBQuery, Keywords:=Keywords.DataBase, Level:=EventLevel.Informational)> _
Public Sub DBQueryStart(ByVal sqlQuery As String)
    WriteEvent(5, sqlQuery)
End Sub

Applies to