BT

InfoQ Homepage News Silverlight to Not Support ArrayList

Silverlight to Not Support ArrayList

Bookmarks

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

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

BT

Is your profile up-to-date? Please take a moment to review and update.

Note: If updating/changing your email, a validation request will be sent

Company name:
Company role:
Company size:
Country/Zone:
State/Province/Region:
You will be sent an email to validate the new email address. This pop-up will close itself in a few moments.