ArrayCollection与FLEX中的矢量对象 [英] ArrayCollection versus Vector Objects in FLEX

查看:162
本文介绍了ArrayCollection与FLEX中的矢量对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都可以告诉我一个ArrayCollection和Flex中的矢量之间的适用差异?我不确定是否应该使用另一个。我看到Vector是类型安全的,这让我感觉好多了,但是有缺点吗?

  public var ac:ArrayCollection = new ArrayCollection的(); 



  public var vec:Vector。< String> = new Vector。< String>(); 

谢谢。

解决方案<另外,Vector的速度比Array快3倍,比ArrayCollection快18倍。



经验法则是




  • 如果您不需要数据绑定/事件通知,请使用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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆