开发者

What is the rationale not to use ArrayList in Silverlight?

开发者 https://www.devze.com 2023-04-10 17:13 出处:网络
I have come across this code snippet in a source code #if SILVERLIGHT internal static System.Collections.IList CreateArrayList()

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?


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?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号