Mega Code Archive

 
Categories / C# by API / System Diagnostics
 

EventLog SourceExists

using System; using System.Diagnostics; class MainClass {     public static void Main ()      {         if (!EventLog.SourceExists("MyEventSource"))          {             EventLog.CreateEventSource("MyEventSource", "Application");         }         EventLog.WriteEntry(             "MyEventSource",                            "A simple test event.",                     EventLogEntryType.Information,              1,                                          0,                                          new byte[] {10, 55, 200}                );     } }