My Code:
public class Contact
{
public string id{ get; set; }
public string contact_type_id { get; set; }
public string value{ get; set; }
public string person_id { get; set; }
public Contact()
{
}
}
public class Contact:Base.Contact
{
public ContactType ContactType { get; set; }
public Person Person {get; set;}
public Contact()
{
ContactType = new ContactType();
Person = new Person();
}
}
And:
Contact c = new Contact();
Base.Contact cb = (Base.Contact)c;
The Problem:
The **cb** is set to **Contac** and not to **Base.Contact**.
Have any trick to do that????
I read the answers and still do not understand the problem!
What is the problem with the above code?
Besides, from the comments, I understand that you need to serialize the base class only. I think there is no problem, to begin with. Look at the example-
Now, if you must make your serialize function virtual, then yes, there is problem. Then this might help –