public void ApplyRules(string propertyName) { List <string> propertyErrors = Rules.ApplyRules((T)this, propertyName); if (propertyErrors != null && propertyErrors.Count > 0) { if (Errors.ContainsKey(propertyName)) { Errors[propertyName].Clear(); } else { Errors[propertyName] = new List <string>(); } Errors[propertyName].AddRange(propertyErrors); } else { Errors.Remove(propertyName); } OnErrorsChanged(propertyName); }