C#C
C#4y ago
yatta

❔ How to write Process name into XML file ?

I try to write my Process name into xml file like this:
foreach(var process in Process.GetProcessesByName(ProcessName))
                {
                    XmlNode startTimeNode = processedData.CreateElement("StartTime");
                    startTimeNode.AppendChild(processedData.CreateTextNode(process.StartTime.ToString()));
                    processNode.AppendChild(startTimeNode);
                }

but when I try to run the code, it skip the process name for first 2 records, and only from 3rd record onwards, it write down enough information of it.
Was this page helpful?