了解协变和逆变在C#4.0 [英] Understanding Covariance and Contravariance in C# 4.0

查看:122
本文介绍了了解协变和逆变在C#4.0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看了一个关于它的视频第9频道,但我真的不明白了。

I watched a video about it on Channel 9 but I didn't really understand it much.

有人可以给我这些,很容易理解一个简单的例子?之后,也许它将如何在实践中使用?

Can someone please give me a simple example about these that's easy to understand? After that maybe how it would be used in practice?

推荐答案

我也想过这个视频由埃里克利珀是非常明确的:

I also thought this video by Eric Lippert was very clear:

1部分:<一href="http://msdn.microsoft.com/en-us/vcsharp/ee672314.aspx">http://msdn.microsoft.com/en-us/vcsharp/ee672314.aspx

2部分:<一href="http://msdn.microsoft.com/en-us/vcsharp/ee672319.aspx">http://msdn.microsoft.com/en-us/vcsharp/ee672319.aspx

这也带来了,我从来没有听说过,不安全的协方差数组一个有趣的案例。

It also brings up an interesting case that I had never heard about before, about unsafe covariance with arrays.

这篇关于了解协变和逆变在C#4.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆