System.Diagnostics.EventLog.Entries Property

Gets the contents of the event log.

Syntax

[System.ComponentModel.Browsable(false)]
[System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)]
[System.Diagnostics.MonitoringDescription("The entries in the log.")]
public EventLogEntryCollection Entries { get; }

Value

Documentation for this section has not yet been entered.

Remarks

Use the EventLog.Entries member when reading from the event log.

Because the property is read-only, you cannot modify an entry or write to the log using EventLog.Entries. Instead, specify a EventLog.Source and call erload:System.Diagnostics.EventLog.WriteEntry to write a new log entry. You can use EventLog.Entries to count the number of entries in the event log, and view each System.Diagnostics.EventLogEntry in the collection. Use the indexed EventLogEntryCollection.Item(int) member to retrieve information about a specific entry, such as EventLogEntry.Message, EventLogEntry.Category, EventLogEntry.TimeWritten, or EventLogEntry.EntryType.

It is not necessary to specify a EventLog.Source when only reading from a log. You can specify only the EventLog.Log name and EventLog.MachineName (server computer name) properties for the System.Diagnostics.EventLog instance. In either case, the EventLog.Entries member is automatically populated with the event log's list of entries. You can select the appropriate index for an item in this list to read individual entries.

An important distinction between reading and writing log entries is that it is not necessary to explicitly call a read method. After the EventLog.Log and EventLog.MachineName are specified, the EventLog.Entries property is automatically populated. If you change the value of the EventLog.Log or EventLog.MachineName property, the EventLog.Entries property is repopulated the next time you read it.

Note:

You are not required to specify the EventLog.MachineName if you are connecting to a log. If you do not specify the EventLog.MachineName, the local computer, ".", is assumed.

Requirements

Namespace: System.Diagnostics
Assembly: System (in System.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0