c# - Do generic classes have a base class? -


i pass generic interface function:

private i<t> createstubrepository<t, >()  : agenericbaseclass 

so wondering if generic interfaces implement base class or specific interface?

i know using reflection can test if generic class dont see helping me

well. what's point of forcing usage of any interface? not (or question).

you should more this:

public interface imyrepository<t> { }  public class repository<t> : imyrepository<t> { }   private imyrepository<tentity> createstubrepository<tentity>() {      return new repository<tentity>(); }  var repos = createstubrepository<user>(); 

update

thanks answer thats not asking. want know class implements generic interface have base class or inherit interface? dont want force interface more question of object passed generic

classes not inherit interfaces. implement them. different subtle important.

a class can inherit class. means if not specify class inherits still inherit object. , wont change no matter how many interfaces class implement.

class myclass : icoolinterface // inherits object class mylist : arraylist, isomeinterface // inherits arraylist class mygenericlist<t> : ilist<t> // inherits object. 

Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -