/// <summary> /// Removes all comment nodes from a list of nodes. /// </summary> /// <param name="context">The node within which to remove comments.</param> /// <returns><c>true</c> if any comments were removed; otherwise, <c>false</c>.</returns> private void RemoveComments(INode context) { foreach (var comment in GetAllNodes(context).OfType <IComment>().ToList()) { var e = new RemovingCommentEventArgs { Comment = comment }; OnRemovingComment(e); if (!e.Cancel) { comment.Remove(); } } }
/// <summary> /// Raises the <see cref="E:RemovingComment" /> event. /// </summary> /// <param name="e">The <see cref="RemovingCommentEventArgs"/> instance containing the event data.</param> protected virtual void OnRemovingComment(RemovingCommentEventArgs e) { RemovingComment?.Invoke(this, e); }