public IEnumerable <ValidationResult> Validate(ValidationContext validationContext) { if (Name == Summary) { yield return(new ValidationResult("Description can't just contain the name")); } if (Summary.Contains("@")) { yield return(new ValidationResult("Description can't contain @ characters")); } }
public void addMySelf(object sender, PropertyChangedEventArgs e, DateTime dateA, DateTime dateB, CheckBox Topic_HideRead) { if ((Title.Contains(e.PropertyName) | Summary.Contains(e.PropertyName)) && !target.Contains(this)) { //target.Add(this); DateTime itemDate = DateTime.MinValue; DateTime.TryParse(PublishDate, out itemDate); bool withinRange = (dateA <= itemDate) && (dateB >= itemDate); if ((!(bool)Topic_HideRead.IsChecked || !HasRead) && withinRange) { target.Add(this); } else // otherwise do not display and uncheck checkbox { IsSelected = false; } } Hit++; }
public override List <string> Generate(int indent) { List <string> list = new List <string>(); if (!string.IsNullOrEmpty(Summary)) { if (!Summary.Contains("<")) { list.Add("///<summary> {0} </summary>".R(Summary).Ind(indent)); } else { list.Add(Summary); } } Attributes.ForEach(a => list.Add("[{0}]".R(a).Ind(indent))); list.Add("{5} {0}{1}{2}({3}){4}{6}".R( IsOverride ? "override " : "", IsConstructor ? "" : (Type + " "), Name, Params, !string.IsNullOrEmpty(SignatureParams) ? " : " + SignatureParams : "", Access, SignatureOnly ? ";" : "").Ind(indent)); if (!SignatureOnly) { list.Add("{".Ind(indent)); Body.ForEach(b => list.Add(b.Ind(indent + 1))); list.Add("}".Ind(indent)); } list.Add("".Ind(indent)); return(list); }