I'm currently working on creating an Assembly with virtual properties. The examples on MSDN are only creating normal properties. How do I create a class inside an assembly which has virtual properties?
I would like to be able to generate a class like this:
public class ClassA
{
public virtual int Id { get; set; }
public virtual string Name { get; set; }
public virtual string ClassName { get; set; }
public virtual ClassB Partner { get; set; }
}
public class ClassB
{
public virtual int Id { get; set; }
public virtual string Name { get; set; }
}
The PropertyBuilder class doesn't have PropertyAttributes.Virtual, so I don't know how to create a virtual property. If I create this class in Visual Studio myself, and then open it in Reflector, the properties themselfes are virtual, so it is possible.
How can it be done?