EventAttribute.Opcode Properti

Definisi

Mendapatkan atau mengatur kode operasi untuk peristiwa tersebut.

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

Nilai Properti

Salah satu nilai enumerasi yang menentukan kode operasi.

Contoh

Contoh berikut menunjukkan cara menggunakan Opcode properti untuk menentukan kode operasi. Contoh kode ini adalah bagian dari contoh yang lebih besar yang disediakan untuk EventSource kelas .

[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
[Event(6, Opcode = EventOpcode.Stop, Task = Tasks.DBQuery, Keywords = Keywords.DataBase, Level = EventLevel.Informational)]
public void DBQueryStop() { WriteEvent(6); }
<[Event](6, Opcode:=EventOpcode.Stop, Task:=Tasks.DBQuery, Keywords:=Keywords.DataBase, Level:=EventLevel.Informational)> _
Public Sub DBQueryStop()
    WriteEvent(6)
End Sub

Berlaku untuk