I need to add a class (Type) to the CodeNamespace. I have a C# class already written but I don't want to convert it manually to CodeDOM. Is there a way to load an existing into a CodeTypeDeclaration.
It can be runtime or pre-build process.
I need to add a class (Type) to the CodeNamespace. I have a C# class already written but I don't want to convert it manually to CodeDOM. Is there a way to load an existing into a CodeTypeDeclaration.
It can be runtime or pre-build process.
You can compile code from files using codedom CompileAssemblyFromSource. I added an example which set the class content and compile it like here.
For more information you can explore for usages of CompileAssemblyFromSource.