Lets say I have a base class and child like this:
class BaseType
{
string Name{get;set;}
string AddressLine1 {get;set;}
string PostalCode {get;set;}
}
class ChildType : BaseType
{
string extrafield {get;set;}
}
Edit:
My custom Update method is the same for both objects for all but the one extra field. These objects are used in WCF services, so reusing a custom SET WCF Service is what I’m trying to do.
So I would pass in either a BaseType or a ChildType; be able to access the base properties for either object and do what ever logic.
I’m trying to reduce duplication of code.
You can just use
BaseTypefor the argument to the method:This allows you to write: