匿名类型可以从另一个类型继承? [英] Can an anonymous type inherit from another type?

查看:212
本文介绍了匿名类型可以从另一个类型继承?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据对<一个MSDN文档href="http://msdn.microsoft.com/en-us/library/system.stringcomparer.ordinalignorecase.aspx"><$c$c>StringComparer.OrdinalIgnoreCase属性:

在OrdinalIgnoreCase属性返回从 StringComparer 类。

The OrdinalIgnoreCase property actually returns an instance of an anonymous class derived from the StringComparer class.

这是一个功能,我不熟悉,匿名类型继承?或者通过匿名类也撰文只是意味着内部类派生从 StringComparer ,不可见的客户端code?

Is this a feature I'm unfamiliar with—anonymous types with inheritance? Or by "anonymous class" did the author simply mean "internal class deriving from StringComparer, not visible to client code"?

推荐答案

如果你看一下源$ C ​​$下StringComparer,你可以看到,OrginalIgnoreCase返回OrdinalComparer,这是从StringComparer派生的一个实例。

If you look at the source code for StringComparer, you can see that OrginalIgnoreCase returns an instance of OrdinalComparer, which is derived from StringComparer.

没有什么匿名关于这个,我可以看到,它只是它的的内部的,所以你不能从框架之外看到它。

There's nothing 'anonymous' about this that I can see, it's just that it's internal so you can't see it from outside the framework.

这篇关于匿名类型可以从另一个类型继承?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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