Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the rationale not to use ArrayList in Silverlight?

I have come across this code snippet in a source code

#if SILVERLIGHT
        internal static System.Collections.IList CreateArrayList()
        {
            return new List<object>();
        }

#else
        internal static System.Collections.IList CreateArrayList()
        {
            return new ArrayList();
        }

#endif

What might be the purpose of this different treatment?

like image 253
Louis Rhys Avatar asked Dec 27 '22 13:12

Louis Rhys


1 Answers

Silverlight doesn't have the deprecated non-generic collection classes; they are not merely discouraged; they're not there at all.

What is bizarre about that code is: clearly it works for the SilverLight case, so why leave the old code in at all? There's no compelling benefit to using the ArrayList, is there?

like image 74
Eric Lippert Avatar answered Jan 17 '23 01:01

Eric Lippert