Aracılığıyla paylaş


EventAttribute.Keywords Özellik

Tanım

Olay için anahtar sözcükleri alır veya ayarlar.

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

Özellik Değeri

Sabit listesi değerlerinin bit düzeyinde birleşimi.

Örnekler

Aşağıdaki örnekte, olay anahtar sözcüklerini tanımlamak için özelliğinin Keywords nasıl kullanılacağı gösterilmektedir. Bu kod örneği, EventSource sınıfı için sağlanan daha büyük bir örneğin parçasıdır.

public static class Keywords
{
    public const EventKeywords Page = (EventKeywords)1;
    public const EventKeywords DataBase = (EventKeywords)2;
    public const EventKeywords Diagnostic = (EventKeywords)4;
    public const EventKeywords Perf = (EventKeywords)8;
}
Public Class Keywords
    Public Const Page As EventKeywords = CType(1, EventKeywords)
    Public Const DataBase As EventKeywords = CType(2, EventKeywords)
    Public Const Diagnostic As EventKeywords = CType(4, EventKeywords)
    Public Const Perf As EventKeywords = CType(8, EventKeywords)
End Class
[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

Şunlara uygulanır