RosettaCodeData/Task/Write-to-Windows-event-log/C-sharp/write-to-windows-event-log.cs
Ingy döt Net 68f8f3e56b all tasks
2013-04-11 01:07:29 -07:00

20 lines
453 B
C#

using System.Diagnostics;
namespace RC
{
internal class Program
{
public static void Main()
{
string sSource = "Sample App";
string sLog = "Application";
string sEvent = "Hello from RC!";
if (!EventLog.SourceExists(sSource))
EventLog.CreateEventSource(sSource, sLog);
EventLog.WriteEntry(sSource, sEvent);
EventLog.WriteEntry(sSource, sEvent, EventLogEntryType.Information);
}
}
}