Search code examples
c#dynamic-compilation

How can i create a partial class at runtime?


How can i create a partial class at runtime?

Example: I have a class

public partial class A
{

}

I want to create partial of my A class at runtime from an XML file. because I don't compile my project when any change in code. I know this is little meaning less but i need this.

XOML files work for me?


Solution

  • The point of partial classes is to be able to define parts of it in different source files. In the end, after compilation, what you have is a regular class, indistinguishable of any other. So there is not such a thing as "instantiating a partial class".