ArrayCollection与FLEX中的矢量对象 [英] ArrayCollection versus Vector Objects in FLEX
本文介绍了ArrayCollection与FLEX中的矢量对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
public var ac:ArrayCollection = new ArrayCollection的();
public var vec:Vector。< String> = new Vector。< String>();
谢谢。
解决方案<另外,Vector的速度比Array快3倍,比ArrayCollection快18倍。
$ b $如果数组中的所有元素具有相同的类型(并且您想要强打字),则使用Vector AND
经验法则是
- 如果您不需要数据绑定/事件通知,请使用Array
$ b $如果数组中的所有元素具有相同的类型(并且您想要强打字),则使用Vector AND
- / li>
Can anyone tell me the applicable differences between an ArrayCollection and a Vector in flex? I'm unsure if I should be using one over the other. I saw that Vector is type safe and that makes me feel better, but are there disadvantages?
public var ac:ArrayCollection = new ArrayCollection();
versus
public var vec:Vector.<String> = new Vector.<String>();
Thanks.
解决方案
Additionally, Vector is about 3 times faster than Array, which is about 18 times faster than ArrayCollection.
rule of thumb is
- if you don't need data binding / events notifications, use Array
AND
- if all elements in the array are of the same type (and you want strong typing), use Vector.
这篇关于ArrayCollection与FLEX中的矢量对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文