gpt4 book ai didi

actionscript-3 - 我可以将 AS3 中的 <> 语法用于 Vector. 以外的任何内容吗?

转载 作者:行者123 更新时间:2023-12-04 06:03:29 25 4
gpt4 key购买 nike

我最近学习了一些 C# 并注意到 <>语法使用很多,例如:

Content.Load<AssetType>("asset name");

我在 AS3 中看到的唯一地方是在使用 Vectors 时:
var enemies:Vector.<Enemy> = new Vector.<Enemy>();

我可以在 ActionScript 3 中以某种方式自己实现这种语法的使用吗?例如,我可能希望自己的方法类似于 Content.Load() .

最佳答案

您所指的语法称为泛型,而 Vector 是它们目前可在 AS3 中使用的唯一方式。

Here is a link to a related question关于 AS3 的泛型,为什么你不能创建自己的。

希望这可以帮助!

关于actionscript-3 - 我可以将 AS3 中的 <> 语法用于 Vector.<T> 以外的任何内容吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8656475/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com