Saw this signature today:
public interface ISomeInterface<in T>
What impact does the in parameter have?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You could read about generic variance and contravariance introduced in .NET 4.0. The impact that the
inkeyword has on the interface is that it declares it as contravariant meaning thatTcan only be used as input method type. You cannot use it as return type on the methods of this interface. The benefit of this is that you will be able to do things like this (as shown in the aforementioned article):