using System.Collections.Generic;
public string Role {get;set;}
public string Publisher {get;set;}
public string Id {get;set;}
public string Name {get;set;}
public Product[] ProductsContributedTo {get;set;}
public static List<Contributor> contributors = new List<Contributor>();
public static void Main()
ProductsContributedTo = new Product[] {
new Product() {Id = 1, Role = "Author", Publisher = "Maybridge"},
new Product() {Id = 10, Role = "Author", Publisher = "Persons"}
ProductsContributedTo = new Product[] {
new Product() {Id = 2, Role = "Author", Publisher = "Maybridge"},
new Product() {Id = 3, Role = "Illustrator", Publisher = "Boom Town"}
Name = "Sedgewick F0ley",
ProductsContributedTo = new Product[] {
new Product() {Id = 4, Role = "Illustrator", Publisher = "Boom Town"},
new Product() {Id = 5, Role = "Illustrator", Publisher = "Boom Town"}
List<Contributor> authors = contributors.SelectMany(people => people.ProductsContributedTo
.Where(product => product.Role == "Author")
foreach(var person in authors)
Console.WriteLine("Author is " + person.Name + " and contributes to: ");
foreach(var product in person.ProductsContributedTo)
if(product.Role == "Author")
Console.WriteLine("CORRECT Id: " + product.Id + " - Role: " + product.Role);
if(product.Role != "Author")
Console.WriteLine("INCORRECT Id: " + product.Id + " - Role: " + product.Role);