The World’s Leading Microsoft .NET Magazine
   
 
The .NET Addict's Blog

My Top Tags

                                                           

My RSS Feeds








I heart FeedBurner

Latest Diggs - Programming

Computers Blogs - Blog Top Sites

Site Hits

Total: 4,868,426
since: 19 Jan 2005

Non-generic collections will be removed from Silverlight 1.1

posted Fri 29 Jun 07

I just read that the Silverlight 1.1 next release (they didn't say if it would be another Alpha or if it would be Beta 1) is going to have some breaking changes in it. This is one of the few times in Microsoft history that I've actually been both pleased to see breaking changes and that Microsoft has actually had the ba...er...guts ... to break things that need breaking instead of piling on scar tissue for the sake of backwards compatibility.

Basically what they've done is outlawed the use of non-generic collections. This should, in my opinion, have been done immediately with the release of the .NET Framework 2.0, but I guess this will have to do. In the spirit of keeping the Silverlight runtime as small as possible, I couldn't agree more with the decision to scrap the non-generic collections like the ArrayList, the non-generic Hashtable, etc.

Here are a list of the classes that will be deprecated, and their Generic equivalents (pulled from this blog post on the BCL blog):

 

Non-genericGeneric replacement
ArrayListList<T>
BitArrayList<Boolean> [note that this isn’t stored as compactly as BitArray but represents the same information]
CaseInsensitiveComparerComparer<T>
CaseInsensitiveHashCodeProviderComparer<T>
CollectionBaseCollection<T>
ComparerComparer<T>
CompatibleComparerComparer<T>
DictionaryBaseKeyedCollection<K,V>
DictionaryEntryKeyValuePair<K,V>
HashtableDictionary<K,V>
KeyValuePairsKeyValuePair<K,V>
QueueQueue<T>
ReadOnlyCollectionBaseReadOnlyCollection<T>
SortedListList<T>
StackStack<T>

If you really don't know at compile time what type you're going to be stuffing in your collection, and you can't even infer a base class or a common interface used by all the items in the collection, then you can always resort to using things like List<object>, however, I have yet to see a piece of code that couldn't be made slightly more type-safe than that.

tags:  

links: digg this    del.icio.us    technorati    reddit

AddThis Social Bookmark Button




Tag Related Posts

What's New in Silverlight 3

Fri 20 Mar 09 2:38 P GMT-05

Live Mesh Tutorial 1 - Hello Live Mesh

Thu 06 Nov 08 2:33 P GMT-05

My Silverlight Plugin has expired - WTF?!?

Thu 08 Nov 07 7:34 P GMT-05
tags:    

Silverlight 1.1 Alpha Refresh

Fri 10 Aug 07 2:09 P GMT-05
tags:    

My Appearance in the RIA Shootout on sys-con.tv

Tue 05 Jun 07 11:41 A GMT-05
tags:              

Silverlight and Astoria - First Impressions

Mon 04 Jun 07 1:40 A GMT-05
tags:    

I'm going to be on TV (sort of)

Sat 02 Jun 07 12:19 P GMT-05
tags:              

Silverlight Revisited

Sat 21 Apr 07 9:48 P GMT-05
tags:    

Will Silverlight be DOA?

Mon 16 Apr 07 8:02 P GMT-05