EventAttribute.Opcode Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets or sets the operation code for the event.
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
Property Value
One of the enumeration values that specifies the operation code.
Examples
The following example shows how to use the Opcode property to specify operation codes. This code example is part of a larger example provided for the EventSource 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
[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
Applies to
Samarbeid med oss på GitHub
Du finner kilden for dette innholdet på GitHub. Der du også kan opprette og se gjennom problemer og pull-forespørsler. Hvis du vil ha mer informasjon, kan du se vår bidragsyterveiledning.