Skip to content

Make IImmutableList covariant like IReadOnlyList, IEnumerable etc. #16011

@ghost

Description

@ghost

I need System.Collections.Immutable interfaces such as IImmutableList to be covariant just like IReadOnlyList, IEnumerable in order to be able to write stuff like this:

public interface IResources<out T> where T : IDomainEntity
{
        IImmutableList<T> ShouldWorkButCompilerGivesErrorDueToIImmutableListNotCovariant { get; }
        IReadOnlyList<T> Works { get; }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions