BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Silverlight to Not Support ArrayList

Silverlight to Not Support ArrayList

In 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.

According to Inbar Gazit of Microsoft's Base Class Library team, the non-generic collections are not going to ship with Silverlight 1.1. This means that while you can continue to use them with the main .NET distribution, they cannot be used in any assembly targeting Silverlight. The affected classes are:

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

Just to make it clear, Microsoft is not planning on removing these classes or marking them as obsolete in the main .NET distribution at this time.

In order to support scenarios such as data binding where the type is not necessarily known, the following non-generic interfaces will be kept in Silverlight.

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

Some generic collections have also been dropped from Silverlight. Inbar explains,

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.

Inbar also has a post on why generic collections should be used in traditional .NET programming and suggestions on making the change to an existing codebase.

Rate this Article

Adoption
Style

BT