Hi All,
I have an object that has several parameters. One of the parameters is array of another class that has its own parameters.
Here is a stripped down definition:
public class Project
{
public string Name { get; set; }
public Customfield[] CustomFields { get; set; }
}
public class Customfield
{
public string Name { get; set; }
public string[] Values { get; set; }
}
I also have an array that contains one or more Project.
I am trying to use Linq to find the Project that has a particular value in one of the Customfields. The values in this Customfield are unique.
First, is this possible?
Here is my attempt that did not work.
j.Projects.Where(p => p.CustomFields.Where(pl => pl.Name == “Location”).FirstOrDefault().Values[0].Trim().Equals(jobnum.Trim())).FirstOrDefault();