Whats the difference between ISomeInterface<in TEntity>
and ISomeInterface<out TEntity>
in c#. I saw this while trying to understand my company code. any king of help would be appreciated. Also, I want to know if there is any difference in implementing both.
Asked
Active
Viewed 22 times
0

David Browne - Microsoft
- 80,331
- 6
- 39
- 67

Oluwadamilola Adegunwa
- 321
- 2
- 10
-
1Duplicate of [out
vs – Sean Skelly Apr 22 '20 at 22:18in Generics](https://stackoverflow.com/questions/10956993/out-t-vs-t-in-generics?)? Though that answer doesn't specifically talk about `in`. You can find that one [here](https://stackoverflow.com/questions/6723082/what-does-an-in-generic-parameter-do). Both SO questions suggest you read up on [contravariance and covariance](https://learn.microsoft.com/en-us/dotnet/csharp/programming-guide/concepts/covariance-contravariance/). @devNull found an even better SO question. -
3Does this answer your question? [Understanding Covariant and Contravariant interfaces in C#](https://stackoverflow.com/questions/2719954/understanding-covariant-and-contravariant-interfaces-in-c-sharp) – devNull Apr 22 '20 at 22:19