views:

100

answers:

3

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?

+7  A: 

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

Jon Seigel
+11  A: 

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".

Otávio Décio
+4  A: 

You can't.

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

hometoast