This project is read-only.

How to add a class instance to a CodeDOM Graph

Oct 9, 2013 at 4:07 PM

I faced a problem in working with Linq2CodeDOM library.

Here's a sample of coding with LinqToCodeDOM :
static void Main()
            var c = new CodeDomGenerator();

                .AddMethod(MemberAttributes.Public | MemberAttributes.Static, ()=>"Print",
                    Emit.stmt(() => Console.WriteLine("Hello, world!")),
My Problem => I have a class and want to add it to the CodeDOM Graph (CodeDOMGenerator) but as I seen, it just let me to add CodeMemberMethod or the inner structure of a method as CodeStatement[] in it's constructor.

But I want to add the instance of the class that I created, not write it's structure.

Do anybody know how to add an instance of a class to a CodeDOM Graph using LinqToCodeDOM or even Microsoft.CodeDOM ?

Link of this question on MSDN Forum :
Oct 9, 2013 at 4:09 PM
In actually I want to add some Win Forms that I created, dynamically to my namespace. (CodeDOM Graph).

But the problem is here that it's vain and also difficult to create the whole of my forms through code with the CodeDOM's structures.

So I'm searching for a way to directly add my form's instance to my CodeDOM Graph instead of writing them using code.

Any idea!?