Simple IList update question: given the following nested objects, how do you update the deepest nested property given the primary key?
public class Recipe {
public int RecipeID {get;set;} // PK
public string name {get;set;}
public IList<RecipeStep> RecipeSteps {get;set;}
}
public class RecipeStep {
public int RecipeID {get;set;} // PK
public int RecipeStepID {get;set;} // PK
public string name {get;set;}
public IList<Ingredient> {get;set;}
}
public class Ingredient {
public int RecipeID {get;set;} // PK
public int RecipeStepID {get;set;} // PK
public int IngredientID {get;set;} // PK
public string name {get;set;}
}
So how could I set the Recipe.RecipeStep.Ingredient.name given that RecipeID = 2, RecipeStepID = 14, and IngredientID = 5 (which are the values of the int, not the index). Hopefully there is some direct way to reference these items without a loop. Linq Expressions are fine. (When I tried Linq, I ended up changing a copy of the value, not the value itself. LOL).