public void AddInstance(object obj, string name)
        {
            CreatedInstance createdInstance = new CreatedInstance(obj.GetType(), new object[0], name, false);

            createdInstance.Object = obj;
            createdInstances.Add(createdInstance);
        }
        public object GetInstance(string name)
        {
            CreatedInstance instance = GetCreatedInstance(name);

            if (instance != null)
            {
                return(instance.Object);
            }
            return(null);
        }
        public override bool Equals(object obj)
        {
            CreatedInstance rhs = obj as CreatedInstance;

            if (rhs != null)
            {
                return(ToString() == rhs.ToString());
            }
            return(base.Equals(obj));
        }
        public object CreateInstance(Type type, ICollection arguments, string name, bool addToContainer)
        {
            CreatedInstance createdInstance = new CreatedInstance(type, arguments, name, addToContainer);

            createdInstances.Add(createdInstance);

            object[] argumentsArray = new object[arguments.Count];
            arguments.CopyTo(argumentsArray, 0);

            object o = null;
            DesignerSerializationManager designerSerializationManager = new DesignerSerializationManager();

            using (designerSerializationManager.CreateSession()) {
                IDesignerSerializationManager manager = designerSerializationManager as IDesignerSerializationManager;
                o = manager.CreateInstance(type, arguments, name, addToContainer);
            }
            createdInstance.Object = o;
            return(o);
        }