EventAttribute.Level Vlastnost

Definice

Získá nebo nastaví úroveň události.

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

Hodnota vlastnosti

Jedna z hodnot výčtu, která určuje úroveň události.

Příklady

Následující příklad ukazuje, jak pomocí Level vlastnosti zadat úrovně událostí. Tento příklad kódu je součástí většího příkladu EventSource pro třídu.

[Event(1, Message = "Application Failure: {0}", Level = EventLevel.Error, Keywords = Keywords.Diagnostic)]
public void Failure(string message) { WriteEvent(1, message); }
<[Event](1, Message:="Application Failure: {0}", Level:=EventLevel.Error, Keywords:=Keywords.Diagnostic)> _
Public Sub Failure(ByVal message As String)
    WriteEvent(1, message)
End Sub
[Event(2, Message = "Starting up.", Keywords = Keywords.Perf, Level = EventLevel.Informational)]
public void Startup() { WriteEvent(2); }
<[Event](2, Message:="Starting up.", Keywords:=Keywords.Perf, Level:=EventLevel.Informational)> _
Public Sub Startup()
    WriteEvent(2)
End Sub
[Event(7, Level = EventLevel.Verbose, Keywords = Keywords.DataBase)]
public void Mark(int ID) { if (IsEnabled()) WriteEvent(7, ID); }
<[Event](7, Level:=EventLevel.Verbose, Keywords:=Keywords.DataBase)> _
Public Sub Mark(ByVal ID As Integer)
    If IsEnabled() Then
        WriteEvent(7, ID)
    End If
End Sub

Platí pro