public static void RemoveElementByClass(this HTMLDocument doc, string value)
 {
     try
     {
         doc.GetElementByClassName(value).RemoveElement();
     }
     catch
     {
     }
 }
Пример #2
0
        public static void RemoveElementsByClass(this HTMLDocument doc, string value)
        {
            while (true)
            {
                var elem = doc.GetElementByClassName(value);

                if (elem == null)
                {
                    break;
                }

                try
                {
                    ((dynamic)elem).parentNode.removeChild(elem);
                }
                catch
                {
                    break;
                }
            }
        }