gpt4 book ai didi

c# - Silverlight 和 ArrayList

转载 作者:太空狗 更新时间:2023-10-29 19:56:23 24 4
gpt4 key购买 nike

Visual Studio 2010 的 Silverlight 是否支持 ArrayList?如果是那么如何使用它,如果不是那么为什么?

如何在Silverlight中使用ArrayList?

最佳答案

Silverlight 现在不支持 ArrayList,请参阅 http://www.infoq.com/news/2007/07/ArrayList-Gone .

编辑:这是此链接的内容,

an effort to reduce the size of the Silverlight runtime, most of the non-generic collection types will be removed. These include types once considered essential to .NET programming including ArrayList, Hashtable, and Comparer.

根据 Microsoft 的 Inbar Gazit Base Class Library团队,非通用集合不会随 Silverlight 1.1 一起提供。这意味着虽然您可以继续将它们用于主要的 .NET 发行版,但它们不能用于任何以 Silverlight 为目标的程序集。受影响的类是:

* ArrayList
* BitArray
* CaseInsensitiveComparer
* CaseInsensitiveHashCodeProvider
* CollectionBase
* Comparer
* CompatibleComparer
* DictionaryBase
* EmptyReadOnlyDictionaryInternal
* Hashtable
* IHashCodeProvider
* KeyValuePairs
* ListDictionaryInternal
* Queue
* ReadOnlyCollectionBase
* SortedList
* Stack

需要说明的是,Microsoft 目前不打算在主要的 .NET 发行版中删除这些类或将它们标记为已过时。

为了支持数据绑定(bind)等类型不一定已知的场景,Silverlight 中将保留以下非泛型接口(interface)。

* IEnumerator
* IEnumerable
* ICollection
* IComparer
* IDictionary
* IDictionaryEnumerator
* DictionaryEntry
* IEqualityComparer
* IList

一些通用集合也已从 Silverlight 中删除。 Inbar 解释道,

Three other generic types were also removed. Queue, Stack and LinkedList were removed from Silverlight. In this case it wasn't because they were non-generic but because they are not considered to be part of the core set of types that we deemed essential to be provided with Silverlight. Remember that Silverlight is a very small download and should only include the smallest set of APIs that will allow for useful development. It's very simple to implement Queue and Stack using List and LinkedList is just a different implementation of List with different performance characteristics and so it's not an essential part of our core collections group.

同时检查 C# - Replacement for.NET ArrayList.ToArray(Type) in Silverlight .

关于c# - Silverlight 和 ArrayList,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4181800/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com