0

I have a class and inheritance like this in my deserializable class file as shown below. I want to create another class called VendorBase which has Xml attribute called Vendor. I want my Customer class to inherit that as well. How can i achieve it?

public class Customer : CustomerBase
{
    [XmlAttribute(AttributeName = "Customer")]
    public string Customer { get; set; }

    [XmlAttribute(AttributeName = "FieldValue")]
    public string FieldValue { get; set; }

}

public class VendorBase
{
    [XmlAttribute(AttributeName = "Vendor")]
    public string Vendor { get; set; }
}
3
  • C# does not support multiple inheritance. Commented Feb 5, 2015 at 22:20
  • You can't without injecting Vendor in the inheritance chain. Why not just add the property to Customer? Commented Feb 5, 2015 at 22:59
  • Thank You Stanley. I could do that but I want my code little neater fso that the future programmers wont get confused.. I was playing with interfaces but not able to get the right way to do it. Commented Feb 6, 2015 at 2:36

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.