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?

Was it helpful?

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.

MSDN: Partial Class Definitions

You can't.

A partial class doesn't exist in the CLR. It's more of a Visual Vtudio trick than anything else.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top