I have a class Annotations, and 2 classes that inherit from it, HousingAnnotations and AutoAnnotations
public class Annotations
{
public string original_posting_date { get; set; }
public string price { get; set; }
}
public class HousingAnnotations : Annotations
{
public string laundry_on_site { get; set; }
public string condo { get; set; }
public string w_d_in_unit { get; set; }
public string street_parking { get; set; }
public string w_d_hookups { get; set; }
public string bedrooms { get; set; }
}
public class AutoAnnotations : Annotations
{
public string vin { get; set; }
public string year { get; set; }
}
What I would like to do is allow for population of either Auto or HousingAnnotation without specifying which type, for instance
AnnotationHelper annotation = new AnnotationHelper{bedrooms = "2", vin = "123"};
or something like that. Since I cannot inherit from both classes, how can I get around this? I know there are workarounds using interfaces, but I do not want to have to call out each property in my AnnotationHelper class. What are some ways to get around this?