dotnet / docs

This repository contains .NET Documentation.
https://learn.microsoft.com/dotnet
Creative Commons Attribution 4.0 International
4.23k stars 5.87k forks source link

Suggestion #17163

Closed xenophilios closed 3 years ago

xenophilios commented 4 years ago

Great article. Thank you. I would like to suggest that you add some explanation on the use of "in" and "out" as modifiers of generic type parameters. For example, the generic form of IComparable is given as IComparable<in T> and the generic form of IEnumerable as IEnumerable<out T>. If explanations are already available in other documents, perhaps you could let us know where to find them. Thank you for your trouble.


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

BillWagner commented 4 years ago

Thanks for writing this @xenophilios

We cover the in and out modifiers in this article.

I'd recommend fixing this by adding a link to that article rather than repeating the information.

I've added the "up for grabs" and "good first issue" labels for any contributor that wishes to make this change.

xenophilios commented 4 years ago

Thank you for the link. The article at the end of it is very useful, but it seems to be dealing with a different issue.

mssteele commented 4 years ago

@xenophilios I think that article is answering your question - the in and out modifiers are to indicate contravariance and covariance. Unfortunately the article does not mention the syntax. This article does. There's also a good Stack Overflow answer here.

xenophilios commented 4 years ago

Thank you very much!

swapniljha001 commented 4 years ago

Can you mention which file needs to be edited to resolve this issue?

santhoshrajr commented 3 years ago

Hello. I am planning on picking this issue. I have gone through the discussion and I figured out that I need to add this link about in and out inside the see also section of Constraints on type parameters - C# Programming Guide. Am i right? Can i pick up this?

dotnet-bot commented 3 years ago

This issue has been closed as part of the issue backlog grooming process outlined in #22351.

That automated process may have closed some issues that should be addressed. If you think this is one of them, reopen it with a comment explaining why. Tag the @dotnet/docs team for visibility.