Im having some trouble getting this generic constraint to work.
I have two interfaces below.
I want to be able to constrain the ICommandHandlers TResult type to only use types that implement ICommandResult, but ICommandResult has its own constraints that need to be supplied. ICommandResult could potentially return a value or reference type from its Result property. Am I missing something obvious? Thanks.
public interface ICommandResult<out TResult>
{
TResult Result { get; }
}
public interface ICommandHandler<in TCommand, TResult> where TCommand : ICommand
where TResult : ICommandResult<????>
{
TResult Execute( TCommand command );
}