EntryWrittenEventArgs.Entry 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
會取得寫入日誌的事件日誌條目。
public:
property System::Diagnostics::EventLogEntry ^ Entry { System::Diagnostics::EventLogEntry ^ get(); };
public System.Diagnostics.EventLogEntry? Entry { get; }
public System.Diagnostics.EventLogEntry Entry { get; }
member this.Entry : System.Diagnostics.EventLogEntry
Public ReadOnly Property Entry As EventLogEntry
屬性值
一個 EventLogEntry 代表寫入事件日誌的條目。
範例
以下範例假設你已經在 中實作了該樣本 EntryWrittenEventArgs(EventLogEntry)。
它會建立一個自訂 EventLog 物件並寫入一個項目。 接著它會利用自訂事件日誌中的第一個項目建立 EntryWrittenEventArgs 一個物件。 此物件用於通知訊息。
protected static void MyOnEntry(Object source, EntryWrittenEventArgs e)
{
EventLogEntry myEventLogEntry = e.Entry;
if (myEventLogEntry != null)
{
Console.WriteLine("Current message entry is: '"
+ myEventLogEntry.Message + "'");
}
else
{
Console.WriteLine("The current entry is null");
}
}
Protected Shared Sub MyOnEntry(source As Object, e As EntryWrittenEventArgs)
Dim myEventLogEntry As EventLogEntry = e.Entry
If Not (myEventLogEntry Is Nothing) Then
Console.WriteLine("Current message entry is: '" + _
myEventLogEntry.Message + "'")
Else
Console.WriteLine("The current entry is null")
End If
End Sub