public static bool IsPropertyValid(ADObject o, PropertyDefinition property, out ValidationError validationError) { bool result = true; validationError = null; ValidationError[] array = o.ValidateRead(); foreach (ValidationError validationError2 in array) { if (validationError2 is PropertyValidationError) { PropertyValidationError propertyValidationError = validationError2 as PropertyValidationError; if (string.Compare(property.Name, propertyValidationError.PropertyDefinition.Name, true, CultureInfo.InvariantCulture) == 0 && property.Type == propertyValidationError.PropertyDefinition.Type) { result = false; validationError = validationError2; break; } } } return(result); }