43

I am wondering why I cant get such simple thing like this on google. This code is not compilable. How can I do this?

public class TestStep<StartEvent, CompletedEvent> 
    where StartEvent : MyBase1, MyInterface1, new() &&
    where CompletedEvent : MyBase2, MyInterface2, new()
{
}

Please help.

1
  • 4
    This is not a duplicate! The referenced duplicate question asks about specifying multiply constraints for a single type. This question asks about specifying constraints for multiple types. Commented Jun 12, 2013 at 19:12

1 Answer 1

76

Try without the "&&"

public class TestStep<StartEvent, CompletedEvent> 
    where StartEvent : MyBase1, MyInterface1, new()
    where CompletedEvent : MyBase2, MyInterface2, new()
{
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.