Compartilhar via


EventAttribute.Task Propriedade

Definição

Obtém ou define a tarefa para o evento.

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

Valor da propriedade

A tarefa para o evento.

Exemplos

O exemplo a seguir mostra como usar a Task propriedade para definir tarefas de evento. Este exemplo de código faz parte de um exemplo maior fornecido para a EventSource classe .

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

Aplica-se a