String[] search1 = Directory.EnumerateFiles(voiceSource, callId + " "+ separator +"*."+ fileFormat +"")
.Where(file => Path.GetFileName(file).StartsWith( callId + " "+ separator +""))
.Select(path => Path.GetFileName(path))
.ToArray();
现在我想将以下数组复制到上面的search1中。换句话说,我想结合两个数组。
String[] search2 = Directory.EnumerateFiles(voiceSource, callId + ""+ separator +"*."+ fileFormat +"")
.Where(file => Path.GetFileName(file).StartsWith(callId + ""+ separator +""))
.Select(path => Path.GetFileName(path))
.ToArray();
请注意,search1的长度可能为零。有什么帮助吗?
答案 0 :(得分:0)
search3 = new type[search1.Length + search2.Length];
search1.CopyTo(search3, 0);
search2.CopyTo(search3, search1.Length);
其中type是数组中元素的类型