Can someone recommend a simple c# code generator. I just looking something with methods like:
GenClass = CreateNewClass(AccessModifier,Name......)
GenClass.Add(new Method(AccessModifier,RetType,Name....){code=@"....."}
GenClass.Add(new Property(AccessModifier,Type, Name....)
........... etc
and after creating all classes\methods and other members we call Code Generation function(where we can specific some parametrs)
Is there such opensource code generator?
Check out Using CodeDOM to generate CSharp (C#) and VB code.
You may want to have a look csscript that relies on CodeDOM.
It allows you to write things like:
var PrintSum = CSScript.LoadMethod(
@"public static void PrintSum(int a, int b)
{
Console.WriteLine((a+b));
}")
.GetStaticMethod();
PrintSum(1, 2);
Be sure to read the doc, it's pretty detailed and you'll find you can do a lot more than what I just copied before.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With