© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•4y ago•
2 replies
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);
                }
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.
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

❔ how to write strings to text file
C#CC# / help
4y ago
❔ How to get an attribute from xml file
C#CC# / help
4y ago
❔ Help deserializing XML file
C#CC# / help
3y ago