I have a search method that is trying to match a director name to an entry in one and/or two arrays. However, I cannot figure out how to print the names of multiple titles if the director has more than one movie in either array.
Right now my code looks like this:
if (director == myDVDs[i].Director || director == myBlu[i].Director)
{
Console.WriteLine("{0}: {1}", i + 1, myBlu[i].Title);
EndOptions();
}
else if (director != myDVDs[i].Director && director != myBlu[i].Director)
{
Console.WriteLine("{0} does not have a movie in the database try again", director);
Console.Clear();
Search();
}
You can use LINQ’s
Concat, like this: