/// <summary>Add the specified model to the parent.</summary> /// <param name="parent">The parent model</param> /// <param name="modelToAdd">The child model.</param> public static void Add(IModel parent, IModel modelToAdd) { modelToAdd.Parent = parent; Apsim.ParentAllChildren(modelToAdd); parent.Children.Add(modelToAdd as Model); Apsim.ClearCaches(modelToAdd); }
/// <summary>Deletes the specified model.</summary> /// <param name="model">The model.</param> public static bool Delete(IModel model) { Locator(model.Parent).Clear(); Apsim.ClearCaches(model); return(model.Parent.Children.Remove(model as Model)); }