How can i create a partial class at runtime?
-
19-09-2019 - |
Question
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".
OTHER TIPS
The partial
keyword is used to separate a class across multiple code files. The compiler merges them together into a single class.
You can't.
A partial class doesn't exist in the CLR. It's more of a Visual Vtudio trick than anything else.