Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is the core CLR of Silverlight 4 the same as 'classic' .Net 4?

I ask this because I have been chasing down a co/contravariance issue in SL4. I asked it twice in SO and got answers along the lines of - "It just works, make sure you are using .net 4". I tried my failing code (and the samples people posted) in SL4 and .Net 4 and the results are different (work in .net fail in sl). So is SL4 actually running on a < 4 version. Or are there just some features left out (accidentally or on purpose). If so what features

What about SL 5?

like image 427
pm100 Avatar asked Sep 08 '11 17:09

pm100


1 Answers

The core compiler in Silverlight 4 supports Covariance and Contravariance, but the framework interfaces (ie: IEnumerable<T>) unfortunately were not marked as covariant (note in the docs that it isn't IEnumerable<out T> as it is in .NET 4).

Silverlight 5 fixes this, "officially" supporting Covariance and Contravariance.

like image 61
Reed Copsey Avatar answered Oct 12 '22 05:10

Reed Copsey