Reputation: 1629
Is it possible somehow to return from Console application "Object"? Xml or Json representation of the object. I know that CLR will look for entrypoint static function that it Should be void or int during execution of Console app.
But is there any common way to return somehow object? Stdout stream? Any ideas?
Upvotes: 2
Views: 6545
Reputation: 7341
You can redirect to either File or other Memory Stream object. From there you can create your XML or JSON object. See this link: http://www.dotnetperls.com/redirectstandardoutput
Upvotes: 3
Reputation: 12654
You can write your object in a serialized form to the console. And other application can read this console output and deseralize the object.
Something like:
App1:
Console.Write(Json.Serialize(obj));
App2:
var p = Process.Start("app1.exe");
var obj = Json.Deserialize(p.StandardOutput.ReadToEnd());
Upvotes: 6