开发者

How to create an instance of IEnumerable<MyClass> in Silverlight Client?

Looks like ArrayList is not available for SL sandbox. so I can't do something like var myCollection= new ArrayList();

So 开发者_如何学JAVAhow to creata an instance of IEnumerable , then I can add many instances to the collection in SL client? Or what kind of collection I should use at Silverlight client?


Use List<T> which implements IEnumerable<T>? There are very few (if any) cases where you'd want to use an ArrayList in preference to a generic List. It's really a legacy from the pre-generics era.


See List<T> in MSDN.

ArrayList isn't strongly typed, avoid using it.


Other things that implement IEnumerable are System.Collections.Generic.List, any array (string[], int[]), also you probably do have the ArrayList, you're just not properly qualifying it with the namespace.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜