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.

没有正确的解决方案

其他提示

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:

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top