I have the following object:
public class RandomModel : Metadata
{
public string Name { get; set; }
public ContentMod[][] Content { get; set; }
public class ContentMod
{
public string Subtitle { get; set; }
public string Text { get; set; }
public string[] List { get; set; }
}
}
I'm trying to search and return a RandomModel that contains a ContentMod that contains a string value input in any of its variables (Subtitle, Text, and/or List).
I am trying to do the equivalent of the following:
So if I want to search the string search input in the text of Name from the RandomModel and if it does contain the search string, return the RandomModel, I would do something like the following:
var randomContent = (from item in RandomContent
where item.Name.ToUpper().Contains(search)
select item).ToList();
Now I am trying to search text within all parameters of the ContentMod.
Something like the following:
var randomContent = (from item in RandomContent
where item.ContentMod.???.ToUpper().Contains(search)
select item).ToList();
I can't seem to figure out the ??? part above. How am I to use linq to iterate a multidimensional object's contents, and if they contain the string search, return the RandomModel.
Any help is much appreciated! Al