Hi,
I'm new to c# although have written in a few other langues in the past. I'm trying to get a list of services and their status and create an xml file from this info.
I use the ServiceController.
ServiceController[] services = ServiceController.GetServices();
If I send the info to the console:-
Console.WriteLine(
"{0},{1}",
service.ServiceName,
service.Status);
}
It works fine such as IMAP,running
If I try to write service.Status to an xml file :-
textWriter.WriteString(service.Status);
I get the error
Error 2 Argument '1': cannot convert from 'System.ServiceProcess.ServiceControllerStatus' to 'string'
I'm confused as I can't see why it can write to the console but not to an XML file.
I hope I 've given enough info and that someone can point me in the right direction.
Many thanks
Hirez.