加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Windows > 正文

为什么Windows Phone 7不完全支持C#规范?

发布时间:2020-12-13 22:28:59 所属栏目:Windows 来源:网络整理
导读:当 Windows Phone 7唯一可用的语言是C#时,为什么Windows Phone 7不能完全支持C#规范?好吧,我可以理解缺乏“动态”支持,但为什么不支持反协方差?为什么我们不熟悉的第三方库以及我们在与Phone 7不兼容的服务器 – 桌面项目中使用?如果我们仍然在这里,有一
当 Windows Phone 7唯一可用的语言是C#时,为什么Windows Phone 7不能完全支持C#规范?好吧,我可以理解缺乏“动态”支持,但为什么不支持反协方差?为什么我们不熟悉的第三方库以及我们在与Phone 7不兼容的服务器 – 桌面项目中使用?如果我们仍然在这里,有一个中间的IL代码有什么意义?

解决方法

请记住,它在Compact Framework CLR上运行 – 它没有桌面CLR的所有功能.

编辑:经过一些拖网,我发现generic variance isn’t supported in the Compact Framework(至少在2005年没有回来,我怀疑它没有实施,因为直到最近才有用):

No support for variance modifiers. Though variance/co-variance forms part of the overall ECMA spec for generics,and is implemented for the full .NET CLR,it is not used in Base Class Library or by C# and VB.

好的,所以它并不“完全支持”C#4(绝对最新版本),但您知道任何不支持的C#3语言功能吗?

在库方面,您正在处理一个大致基于Silverlight 3但具有一些Silverlight 4位的框架,并且已经删除了“桌面”Silverlight的各个方面. (编辑:根据评论中的链接,它应该包含Silverlight 3的所有API.我不确定这是否准确……)换句话说,它是它自己的野兽,真的.即使IL本身可以是便携式的,但在删除各种API时很难保证兼容性.但是,在许多情况下,您可以重建库以定位WP7.我同意必须这样做很烦人,但它比没有可用的更好.

编辑:我声称它使用CF CLR的引用:

Windows Phone 7 Series Developer General FAQ:

What technologies and tools can I use to program for Windows Phone 7 Series?
You can currently use the managed language C# using Silverlight and XNA based on Compact Framework.

Can I use Windows Forms?
No,Windows Forms are not supported in the version of Compact Framework included with
Windows Phone 7 Series.

(然后)

Can I use XNA library calls in Silverlight?
Silverlight and XNA share a common code base in the Compact Framework. If a call is not GUI based,in most cases it can be shared between Silverlight and XNA.

A CF team member’s blog post:

For the developers coming to Windows Phone 7 (WP7) from the Windows desktop let me first clarify that the runtime (CLR) that is running on the WP7 is not the same as the one running on the desktop. The WP7 runtime is known as .NET Compact Framework (NETCF) and it works differently than the “desktop CLR”.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读