internal static PropertyDefinitionConstraint[] GetPropertyDefinitionConstraints(Type type, string propertyName) { PropertyDefinitionConstraint[] array = new PropertyDefinitionConstraint[0]; ProviderPropertyDefinition propertyDefinition = PropertyConstraintProvider.GetPropertyDefinition(type, propertyName); if (propertyDefinition != null) { array = new PropertyDefinitionConstraint[propertyDefinition.AllConstraints.Count]; propertyDefinition.AllConstraints.CopyTo(array, 0); } return(array); }
internal static PropertyDefinitionConstraint[] GetPropertyDefinitionConstraints(object constraintProvider, string propertyName) { PropertyDefinitionConstraint[] result = new PropertyDefinitionConstraint[0]; if (constraintProvider != null) { IPropertyConstraintProvider propertyConstraintProvider = constraintProvider as IPropertyConstraintProvider; if (propertyConstraintProvider != null) { result = propertyConstraintProvider.GetPropertyDefinitionConstraints(propertyName); } else { Type type = (constraintProvider is Type) ? ((Type)constraintProvider) : constraintProvider.GetType(); result = PropertyConstraintProvider.GetPropertyDefinitionConstraints(type, propertyName); } } return(result); }