本文介绍了便携式类库和.NET ConcurrentDictionary的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

看着 http://msdn.microsoft .COM / EN-US /库/ dd287191(V = vs.110)的.aspx ,似乎 ConcurrentDictionary 及其所有的朋友在 System.Collections.Concurrent 命名空间可用于在便携式类库使用。

Looking at http://msdn.microsoft.com/en-us/library/dd287191(v=vs.110).aspx, it seems that ConcurrentDictionary and all of its friends in the System.Collections.Concurrent namespace are available for use in a Portable Class Library.

不过,当我创建要么是F#和C#便携式类库,即使我明确地添加对 mscorlib.dll中,编译时使用失败 ConcurrentDictionary

However, when I create either an F# or C# Portable Class Library, even if I explicitly add a reference to mscorlib.dll, the compilation fails when using ConcurrentDictionary.

为什么?

推荐答案

术语便携式应宽松地应用于现在。当您创建的类库项目,你就会得到提示要支持的目标。你只得到ConcurrentDictionary当选择.NET框架和.NET为Windows应用商店的应用程序。

The term "Portable" should be loosely applied right now. When you create the class library project, you get prompted for the targets you want to support. You'll only get ConcurrentDictionary when you select ".NET Framework" and ".NET for Windows Store apps".

选择任何其他和整个空间消失。

Pick any other and the entire namespace disappears.

这会随着时间的推移更好,我会承担,但Windows Phone 7的,Xbox和Silverlight中都落后于现在。

This will get better over time, I'd assume, but Windows Phone 7, XBox and Silverlight are lagging behind right now.

这篇关于便携式类库和.NET ConcurrentDictionary的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-01 05:36