0

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.

David Browne - Microsoft
  • 80,331
  • 6
  • 39
  • 67
  • 1
    Duplicate of [out vs in 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. – Sean Skelly Apr 22 '20 at 22:18
  • 3
    Does 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

0 Answers0