I need to pass a list of strings as parameter to a console application (developed with C#).
The console application is started with System.Diagnostics.Process.Start like:
string fname = "testDoc";
List<string> myList; //initialized elsewhere
Process console = Process.Start("Client.exe", "-filename:"+fname+ " -list:"+myList);
How can I achieve this?
Running
will execute myList.ToString() and will translate to:
which is not what you want to achieve. Try
or something similar.
UPDATE
Of course, you might want to consider some more civilized methods of passing data to that process. Common ways include:
UPDATE
Given the context supplied in the comment, I’d opt for a completely separate windows service running on the server (non-stop, not invoked) with database used for synchronization:
Taskswith columnsinput data,output dataand any other you might want (like some dates or user IDs)output datacolumnThis is much more robust and scales much better with growing user traffic. The service itself would ideally spawn worker threads for separate tasks to take advantage of multiple cores. With such architecture in place, there’s lots of ways to optimize performance and monitor the tasks.