I got a litta, embarrassed by Pratap Kudpu's answer, and I rewrote {string sSource = "Application Name"; string sLog = "Application";
EventInstance eventInstance = new EventInstance(0, 0, EventLogEntryType.Error); List<string> sEvent = new List<string>(); sEvent.Add("Message 1"); sEvent.Add("Message 2"); sEvent.Add("Message 3"); //Check if Event Source was created (Possibly throw error if you are not running with high privilege) if (!EventLog.SourceExists(sSource)) EventLog.CreateEventSource(sSource, sLog); EventLog.WriteEvent(sSource, eventInstance, sEvent.ToArray());
}
Basically, you create a list of lines with "Lines" or the data you want, create an EventInstance object and write an event instead of WriteEntry
Result:
<EventData> <Data>Message 1</Data> <Data>Message 2</Data> <Data>Message 3</Data> </EventData>
source share