Q: c# Search For XML Element Value Based On Array or List I have code that will create an array of all XML element values called "TrackFileId":
XDocument cpldoc = XDocument.Load(cplsource);

var cpltfid = cpldoc.Descendants(cplns + "TrackFileId").ToArray();

I then need to recursively search a number of parent directories (max 3 levels up) for any files called "ASSETMAP.xml", and parse them for any elements with matching values from the array.
I haven't figured out how to specify [n] number of directories from the starting directory (variable "folder") yet. However, here is how I just find the ASSETMAP just looking in the same directory as "folder", which works:
string assetmap = Directory.GetFiles(folder, "*ASSETMAP*")[0].ToString();

Once I have found all ASSETMAP.xml docs, I need to loop through each "Id" element within them to find any matching values from the array, but I can't get it to work, as it seems to just look for the first item in the array and give up. In this case, the first value in the array is not a match, so the bool is false. 
XDocument assetmapdoc = XDocument.Load(assetmap);

bool cpltfidfound = false;

foreach (var assetC in assetElements)
{
    var innerElementsC = assetC.Descendants(assetns + "Id").First();

    if (!innerElementsC.Value.Equals(cpltfid))
        continue;
    cpltfidfound = true;
}

    if (cpltfidfound)
    {
       //do something
    }


A: SOLVED
The key was Array.Exists . I haven't added the recursive search yet, but this will handle the array search:
foreach (var assetC in assetElements)
{
   var innerElementsC = assetC.Descendants(assetns + "Id").FirstOrDefault().Value;

   if (Array.Exists(cpltfids, element => element.Value == (innerElementsC)))
   {
       MessageBox.Show("MATCH");
   }
   else
   {
       MessageBox.Show("NO MATCH");
   }

