简体   繁体   中英

Is variance of for generic type parameters in C# 4.0 a step closer for higher kind types?

We know that implementing classes are still invariant, despite the fact that their interfaces are variant. However I am inquiring, is cov/contravariance a step closer to parametric polymorphism or these are two separate concepts?

Variance is related to subtyping, not really to kinds. That said, I think you might be able to use some subtyping tricks to get some of the benefits of higher kinds. I'm still stuck with C# 3 though, so I haven't experimented with this very much, but I certainly plan to.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM