-1
 String[] search1 = Directory.EnumerateFiles(voiceSource, callId + " "+ separator +"*."+ fileFormat +"")
                         .Where(file => Path.GetFileName(file).StartsWith( callId + " "+ separator +""))
                         .Select(path => Path.GetFileName(path))
                         .ToArray();

Now I would like to copy the following array to the above search1. On the other word, I would like to combine two array.

  String[] search2 = Directory.EnumerateFiles(voiceSource, callId + ""+ separator +"*."+ fileFormat +"")
                         .Where(file => Path.GetFileName(file).StartsWith(callId + ""+ separator +""))
                         .Select(path => Path.GetFileName(path))
                         .ToArray();

Please note that search1 may be of zero length. Any help?

s.k.paul
  • 7,099
  • 28
  • 93
  • 168

1 Answers1

0
search3 = new type[search1.Length + search2.Length];
search1.CopyTo(search3, 0);
search2.CopyTo(search3, search1.Length);

where type is the type of element in array

from How do I concatenate two arrays in C#?

Community
  • 1
  • 1