I have an abstract class CommandBase<T, X> that I want to have an InnerCommand property.
But since InnerCommand can have different types for T and X than the command containing it, how can I determine this?
Abstract class:
public abstract class CommandBase<T, X> where T : CommandResultBase where X : CommandBase<T, X> { public CommandBase<T, X> InnerCommand { get; set; } (...) }
In the above example, InnerCommand will only accept instances with the same types for T and X, but I need to allow other types.
AddOrderitemCommand:
public class AddOrderitemCommand : CommandBase<AddOrderitemResult, AddOrderitemCommand> { (...) }
May contain WebserviceCommand:
public class GetMenuCommand : CommandBase<GetMenuResult,GetMenuCommand> { (...) }
Please provide syntax to allow this.
source share