Compartir vía


EventAttribute.Task Propiedad

Definición

Obtiene o establece la tarea del 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 de propiedad

Tarea para el evento.

Ejemplos

En el ejemplo siguiente se muestra cómo usar la Task propiedad para definir tareas de eventos. Este ejemplo de código es parte de un ejemplo más grande proporcionado para la clase EventSource.

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

Se aplica a