Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

can i abstract to a base class then override to a generic class?

$
0
0

Hi

Can i do something like this

public abstract class SomeBaseClass
{
    public abstract OtherBaseClass SomeProperty {get;set;}
}

public class SomeClass<T> : SomeBaseClass where T : OtherBaseClass 
{
    public override T SomeProperty {get;set;}
}

when i do this i get saying T doesn't match the inherited abstract member.

What i am trying to do is to have a list of SomeBaseClass which needs access to SomeProperty or doi just do IList<SomeClass<OtherBaseClass>>()


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>