protected void SerializeProperty(IDesignerSerializationManager manager, CodeStatementCollection statements, object value, PropertyDescriptor propertyToSerialize)
        {
            if (propertyToSerialize == null)
            {
                throw new ArgumentNullException("propertyToSerialize");
            }
            if (value == null)
            {
                throw new ArgumentNullException("value");
            }
            if (statements == null)
            {
                throw new ArgumentNullException("statements");
            }
            if (manager == null)
            {
                throw new ArgumentNullException("manager");
            }

            MemberCodeDomSerializer serializer = manager.GetSerializer(propertyToSerialize.GetType(), typeof(MemberCodeDomSerializer)) as MemberCodeDomSerializer;

            if (serializer != null && serializer.ShouldSerialize(manager, value, propertyToSerialize))
            {
                serializer.Serialize(manager, value, propertyToSerialize, statements);
            }
        }
        protected void SerializeEvent(IDesignerSerializationManager manager, CodeStatementCollection statements,
                                      object value, EventDescriptor descriptor)
        {
            if (descriptor == null)
            {
                throw new ArgumentNullException("descriptor");
            }
            if (value == null)
            {
                throw new ArgumentNullException("value");
            }
            if (statements == null)
            {
                throw new ArgumentNullException("statements");
            }
            if (manager == null)
            {
                throw new ArgumentNullException("manager");
            }

            MemberCodeDomSerializer serializer = manager.GetSerializer(descriptor.GetType(), typeof(MemberCodeDomSerializer)) as MemberCodeDomSerializer;

            if (serializer != null && serializer.ShouldSerialize(manager, value, descriptor))
            {
                serializer.Serialize(manager, value, descriptor, statements);
            }
        }