internal IEnumerable <PropertyInfo> GetNewPropertiesForType(CustomType type)
        {
            // We don't support adding properties on these types.
            if (type.IsInterface || type.IsGenericParameter || type.HasElementType)
            {
                yield break;
            }

            // Passing in the underlying type.
            IEnumerable <PropertyInfo> newProperties = AddProperties(type.UnderlyingType);

            // Setting DeclaringType on the user provided virtual properties.
            foreach (PropertyInfo prop in newProperties)
            {
                if (prop == null)
                {
                    throw new InvalidOperationException(SR.InvalidOperation_AddNullProperty);
                }

                VirtualPropertyBase vp = prop as VirtualPropertyBase;
                if (vp == null || vp.ReflectionContext != this)
                {
                    throw new InvalidOperationException(SR.InvalidOperation_AddPropertyDifferentContext);
                }

                if (vp.DeclaringType == null)
                {
                    vp.SetDeclaringType(type);
                }
                else if (!vp.DeclaringType.Equals(type))
                {
                    throw new InvalidOperationException(SR.InvalidOperation_AddPropertyDifferentType);
                }

                yield return(prop);
            }
        }
 protected PropertySetterBase(VirtualPropertyBase property)
     : base(property)
 {
 }