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:-


It works fine such as IMAP,running

If I try to write service.Status to an xml file :-


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

Several days looking at this and suddenly inspiration.

string ss = service.Status.ToString();

hope it may help someone else :)

commented: Pretty widespread situation :P +1