public static void AddComponent(this IMyComponentAggregate aggregate, MyComponentBase component) { Debug.Assert(aggregate != component, "Can not add to itself!"); if (component.ContainerBase != null) { component.OnBeforeRemovedFromContainer(); } aggregate.ChildList.AddComponent(component); component.SetContainer(aggregate.ContainerBase); aggregate.AfterComponentAdd(component); }
public static void AddComponent(this IMyComponentAggregate aggregate, MyComponentBase component) { aggregate.ChildList.AddComponent(aggregate.ContainerBase, component); component.SetContainer(aggregate.ContainerBase); aggregate.AfterComponentAdd(component); }