public void Deserialize(MyObjectBuilder_ComponentContainer builder) { var componentsData = builder.Components; if (componentsData != null) { foreach (var data in componentsData) { var instance = MyComponentFactory.CreateInstance(data.Component.GetType()); instance.Deserialize(data.Component); var dictType = MyComponentTypeFactory.GetType(data.TypeId); Add(dictType, instance); } } }
public void Deserialize(MyObjectBuilder_ComponentContainer builder) { if (builder == null || builder.Components == null) { return; } foreach (var data in builder.Components) { var instance = MyComponentFactory.CreateInstance(data.Component.GetType()); instance.Deserialize(data.Component); var dictType = MyComponentTypeFactory.GetType(data.TypeId); Add(dictType, instance); } }