Silverlight and ArrayList

Does Visual Studio 2010 support Silverlight ArrayList? If so, how to use it, if not, why?

How to use ArrayList in Silverlight?

+7
source share
2 answers

Silverlight no longer supports ArrayList, see http://www.infoq.com/news/2007/07/ArrayList-Gone .

EDIT: Here is the content of this link,

to reduce the size of the Silverlight runtime, most types of non-generic types will be removed. These include types that were considered important for .NET programming, including ArrayList, Hashtable, and Comparer.

According to the Inbar Gazit team at the Microsoft Base Class Library , non-shared collections will not ship with Silverlight 1.1. This means that although you can continue to use them with the main .NET distribution, they cannot be used in any assembler oriented to Silverlight. Affected classes:

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

To make this clear, Microsoft has no plans to remove these classes or mark them obsolete in the main .NET distribution at this time.

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

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

Some generic collections have also been excluded from Silverlight. Inbar explains

Three other types were also removed. Queue, Stack and LinkedList have been removed from Silverlight. In this case, this was not because they were not of a general nature, but because they were not considered part of the main set of types that we consider necessary to provide Silverlight. Remember that Silverlight is a very small load and should include only the smallest set of APIs that will allow you to use useful development. It is very simple to implement Queue and Stack with List and LinkedList - it is just an implementation of List with different performance characteristics, and therefore it is not an essential part of our main collection group.

Also check C # - Replacement for .NET ArrayList.ToArray (Type) in Silverlight .

+13
source share

Alternative uses:

 IList <object> list = new List <object>(); 
+5
source share

All Articles