© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•2y ago•
3 replies
dreadfullydistinct

✅ Covariant return type properties

Am I missing something - I thought that property return types could be covariant if they were readonly. So why does this not compile?

public abstract class C
{
    public abstract object Prop { get; }
}

public class D : C
{
    public override int Prop { get; }
}
public abstract class C
{
    public abstract object Prop { get; }
}

public class D : C
{
    public override int Prop { get; }
}
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

❔ Covariant Interface Return
C#CC# / help
3y ago
Differing covariant arrays [Answered]
C#CC# / help
4y ago
❔ You cannot use a covariant type parameter as a generic type constraint for interface methods.
C#CC# / help
3y ago
❔ Compiler cannot infer lambda return type
C#CC# / help
3y ago