需要Hashtable和Arraylist [英] Need Hashtable and Arraylist
问题描述
有关文件
使用System.Collections;在顶部的
,所以我假设这是它想要的Hashtable对象。
当我尝试构建我的解决方案时,我收到类型或命名空间名称Hashtable无法找到的错误,您是否缺少using指令或程序集引用。
在Microsoft的Hashtable文档中,我看到它说Assembly:mscorlib
但是,如果我尝试添加mscorlib通过项目>添加参考,VS说它不能添加它,因为它被构建系统自动引用。
我缺少什么?
非泛型集合,包括 ArrayList
和 HashTable
不包括在Silverlight中。
这些类是.Net 1.0(没有泛型)的保持,不应该用于新的代码。
相反,您应该使用通用集合— 列表< T>
和字典< TKey,TValue&
。
I am trying to use someone else's C# classes in my Windows 7 Phone app. The classes use objects of type Hashtable.
The file in question has
using System.Collections;
at the top, so I'm assuming that's the Hashtable object it wants.
When I try to build my solution, I get errors that the type or namespace name 'Hashtable' could not be found, are you missing a using directive or assembly reference.
In Microsoft's documentation of Hashtable, I see it says Assembly: mscorlib
But if I try to add mscorlib via Project>Add Reference, VS says it can't add it because it is automatically referenced by the build system.
What am I missing?
The non-generic collections, including ArrayList
and HashTable
, are not included in Silverlight.
These classes are hold-overs from .Net 1.0 (which didn't have generics) and should not be used in new code.
Instead, you should use the generic collections—List<T>
and Dictionary<TKey, TValue>
.
这篇关于需要Hashtable和Arraylist的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!