title: C# object to string and back
body: <p>My problem:<br />
  I have a dynamic codecompiler which can compile a snippet of code. The rest of the code. (imports, namespace, class, main function) is already there. The snippet get inserted into that and then it is compiled to an assembly and executed. This is how user is able execute code snippet. The main function (where the snippet is executed) has a return type of object. This snippet gets executed on a remote computer. The code is send by the client to a webserver. The remote computer reads out the code from the webserver and executes it. On the remote computer I can easily view the type of the returned object and its value. However I can only send strings to the webserver.</p>
  <p>Question:<br />
  How do I convert a object into a string, no matter what the type is and how do I convert it back?</p>
  <p>Tried:<br />
  I tried using ToString(), that works fine when using int, string, double and bool. But with an image or an other type is doesn't work of course because I also need to able to convert it back.</p>