Bagikan melalui


EntryWrittenEventArgs.Entry Properti

Definisi

Mendapatkan entri log peristiwa yang ditulis ke log.

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

Nilai Properti

yang EventLogEntry mewakili entri yang ditulis ke log peristiwa.

Contoh

Contoh berikut mengasumsikan bahwa Anda telah menerapkan sampel di EntryWrittenEventArgs(EventLogEntry).

Ini membuat objek kustom EventLog dan menulis entri ke dalamnya. Kemudian membuat EntryWrittenEventArgs objek menggunakan entri pertama di EventLog kustom. Objek ini digunakan untuk memberi tahu sebuah pesan.

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

Berlaku untuk