-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?

3
  • It's not really clear to me what you are trying to achieve - can you clarify? Commented Jan 25, 2015 at 7:03
  • 1
    stackoverflow.com/questions/304816/… Commented Jan 25, 2015 at 7:06
  • Do you mean you want to just concatenate two arrays? If so, use LINQ: a.Concat(b).ToArray() Commented Jan 25, 2015 at 7:08

1 Answer 1

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#?

Sign up to request clarification or add additional context in comments.

1 Comment

Instead of copying the code from another answer, flag as duplicate of the other question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.