[英]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?
然而,我在询问,cov / contravariance更接近参数多态还是这两个独立的概念?
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.
我仍然坚持使用C#3,所以我没有尝试过这个,但我当然打算这样做。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.