Skip to content

Completely false statement about generic interface inheriting from non-generic interface #47104

Open
@elgonzo

Description

@elgonzo

Type of issue

Other (describe below)

Description

The page contains the false statement

Generic interfaces can inherit from non-generic interfaces if the generic interface is covariant, which means it only uses its type parameter as a return value. In the .NET class library, IEnumerable<T> inherits from IEnumerable because IEnumerable<T> only uses T in the return value of GetEnumerator and in the Current property getter.

Not sure if and what got lost in translation/editing there with these two sentences, but it is obviously entirely false from the beginning to end.

Generic interfaces can inherit non-generic interfaces regardless of variance. And IEnumerable<T> being covariant is not because it inherits IEnumerable or vice versa.

Page URL

https://learn.microsoft.com/en-us/dotnet/csharp/programming-guide/generics/generic-interfaces

Content source URL

https://github.com/dotnet/docs/blob/main/docs/csharp/programming-guide/generics/generic-interfaces.md

Document Version Independent Id

d54ecf19-fccb-3d6b-d990-81529acf44c3

Platform Id

bf75a432-ec19-5df7-3485-3b75577d31e8

Article author

@BillWagner

Metadata

  • ID: be0a00a9-fd5d-3aae-9788-d6b324f17599
  • PlatformId: bf75a432-ec19-5df7-3485-3b75577d31e8
  • Service: dotnet-csharp
  • Sub-service: fundamentals

Related Issues

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions