what do I need to change in my abstract base so that the implementations don't have to implement BOTH methods when only one is needed in any given scenario? My example is:
internal abstract class BaseBar<T> where T : BaseThing
{
protected internal abstract T DataFromXmlElements(IEnumerable<XmlNode> nodes);
protected internal abstract T DataFromXmlElements(IEnumerable<XmlNode> nodes, string[] fieldNames);
}
class FooBarMapper : BaseBar<FooData>
{
protected internal override SforceObjectValueData DataObjectFromXmlElements(IEnumerable<XmlNode> nodes)
{
throw new NotImplementedException();
}
protected internal override FooData DataFromXmlElements(IEnumerable<XmlNode> nodes, string[] fieldNames)
{
FooData o = new FooData
{
bar1 = bar1,
bar2 = bar2
};
return o;
}
}
Cheers.
edit: The design is weird/bad/stupid I know...I'm working with legacy code and time is not on my side right now for a refactor. I'm trying to add the second method with the string array.
Maybe this works out for you?
internal abstract class BaseBar<T> where T : BaseThing
{
protected internal abstract T DataFromXmlElements(IEnumerable<XmlNode> nodes, params string[] fieldNames);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With