tags:

views:

145

answers:

2
A: 

My first look at this came up with the following:

Overload the interface, since both have the interface already implemented. Then, created an Action interface that encapsulates the List, List and ActionType properties of Action1, leaving Action2 to have an empty dummy ActionType property. However, this seems extremely messy and not very extensible (as there are plans for new actions in the future)

Derek Hammer
A: 

I'm not sure if this answers your quesion, but here goes.

First, IActor1 and IActor2 should have a common base interface with shared properties:

public interface IActorBase {
    public Property2 { get; set; }
}

Now, the Actions should have a generic base

public abstract class ActionBase<TActor> where TActor: IActorBase {
    public List<String> StringList { get; set; }
    public List<TActor> ActorList  { get; set; }
}

Then, you implement your Action1 and Action2 as such:

public class Action2 : ActionBase<IActor2> { }

public class Action1 : ActionBase<IActor1> {
    public enum Action1Type Type { get; set; }
}

I'm not sure what more you could do here without more details...

configurator