public override bool IsValid() { IEnumerable <IHTMLItem> captions = Subitems.FindAll(x => x is FigCaption); foreach (var figCaption in captions) // figcaption can be only first or last element { if (figCaption != Subitems.First() && figCaption != Subitems.Last()) { return(false); } } return(true); }
public override bool IsValid() { IEnumerable <IHTMLItem> captions = Subitems.FindAll(x => x is FigCaption); return(captions.All(figCaption => figCaption == Subitems.First() || figCaption == Subitems.Last())); }