EntryWrittenEventArgs.Entry 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得被寫入記錄檔的事件記錄檔項目。
public:
property System::Diagnostics::EventLogEntry ^ Entry { System::Diagnostics::EventLogEntry ^ get(); };
public System.Diagnostics.EventLogEntry Entry { get; }
member this.Entry : System.Diagnostics.EventLogEntry
Public ReadOnly Property Entry As EventLogEntry
屬性值
EventLogEntry,表示被寫入事件記錄檔的項目。
範例
下列範例假設您已經在 中 EntryWrittenEventArgs(EventLogEntry)實作範例。
它會建立自定義 EventLog 物件,並將專案寫入其中。 然後,它會使用自定義 EventLog 中的第一個專案來建立 EntryWrittenEventArgs 物件。 這個對像是用來通知訊息。
void MyOnEntry( Object^ source, EntryWrittenEventArgs^ e )
{
EventLogEntry^ myEventLogEntry = e->Entry;
if ( myEventLogEntry )
{
Console::WriteLine( "Current message entry is: '{0}'", myEventLogEntry->Message );
}
else
{
Console::WriteLine( "The current entry is null" );
}
}
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