连接数组

时间:2015-07-24 13:09:05

标签: arrays unity3d concatenation

我收到错误:错误CS0266:无法隐式转换类型System.Collections.Generic.IEnumerable<string>' to string []'。存在显式转换(您是否错过了演员表?)我在哪里演员?

IEnumerator LoadAllImages()
{
    string[] ARCTOPITHECUSPaths = Directory.GetFiles(@"/Users/kenmarold/Screenshots/ARCTOPITHECUS/", "*.png");      // get every file in chosen directory with the extension.png
    string[] GULONPaths = Directory.GetFiles(@"/Users/kenmarold/Screenshots/GULON/", "*.png");                      

    galleryArray = ARCTOPITHECUSPaths.Concat(GULONPaths);

1 个答案:

答案 0 :(得分:1)

Concat返回IEnumerable。 要将其转换为数组,请执行以下操作:

galleryArray = ARCTOPITHECUSPaths.Concat(GULONPaths).ToArray();