0

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.

8
  • What is the business purpose behind generating new classes dynamically? Commented Nov 4, 2012 at 4:10
  • It's something I'm working on in my spare time. I have an interest in Artificial Intelligence Commented Nov 4, 2012 at 4:12
  • I do too, could you be more specific? Commented Nov 4, 2012 at 4:13
  • I want to generate a class which simply performs the calculations for a trained feed forward network. Just a black box with inputs and outputs for use in other code. I want to see how fast I can get it to run. Commented Nov 4, 2012 at 4:20
  • So you'll need a ton of these to do it genetically? What would it be about using a file that would actually make your process faster? Commented Nov 4, 2012 at 4:22

2 Answers 2

1

Use CodeDom to generate the file.

Sign up to request clarification or add additional context in comments.

Comments

1

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:

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.