Question

I want to write some code that creates a new class dynamically and store it in a .cs file.
I was wondering if there is a standard way of doing this other than just creating strings and writing these to a text file? Basically, I have written an object oriented Neural Net and I want it to be able to output a highly optimized hard wired final version of itself to a new class for use in other code.

No correct solution

OTHER TIPS

Use CodeDom to generate the file.

In addition to writing out the strings into a text file, which is the simplest option that should work for small projects, you could use template engines. Several options are available in .NET:

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top