Angus Eliott3,793 Points
Run a .cs?
I have this snippet of code that I want to run multiple times throughout the execution. I put it in another code file to be run whenever I need it. My question is, how do you run another code file that is in the same solution? and how do I transfer data to and from it?
Steven Parker155,830 Points
There's a mechanism called Process.Start that can cause another executable to run, and you can pass data using streams, a data file, or with command-line arguments. There's a good bit of overhead involved, usually only worthwhile when you're calling a program that you don't have source code for.
But if you have the code, it might be much easier to just include the snippet in the build of each other program that uses it, and just call it as needed. Wouldn't that do the job?