我正在尝试将数组中的元素附加到现有(空)数组
if(attributes.list != "") attributes.array.append(attributes.list.ListToArray());
我得到的是这样的
有没有一种方法可以做到这一点而不必太循环遍历每个项目?
最佳答案
使用 optional merge
parameter :
If set to true, and value parameter is an array, appends array elements individually to the source array. If false (default) the complete array is added as one element at the end, in the source array. If value is not an array this argument is ignored.
设置 merge=true
将单独附加元素,而不是将整个数组作为单个元素附加:
attributes.array.append(attributes.list.ListToArray(), true);
https://stackoverflow.com/questions/33931995/