I have data from input fields on a simple Windows Form, which I'd like to pass back to a batch file or a caller.
The data being returned is complex in nature. Something that could be represented as an XML or JSON payload. So the numeric ExitCode is not suitable.
If I change the main method's return type to string instead of void, the program won't invoke.
The Enviromnent args is immutable, so you can't do something like:
string args[] = Environment.GetCommandLineArgs();
args[1] = 'blah';
(args 0 is program being invoked).
- Environment variables become a pain, because they don't persist after the call returns.
Both these solutions might work, but it seems like extreme overkill, for something that should be simple to do in memory:
- sockets
- write the data to a xml file for the caller to pick up.
You'd think it should be possible to return a string. Is there something I'm missing?
Footnote:
(Unfortunately for me - I had to resort to writing the data out to a file. Writing the data to the Console and redirecting the console output to a file yielded a "file in use by another process" message back in Automation Anywhere, the RPA app I was trying to pass data back to). C'est la vie!