none
Why can't I do element.Elements<BarChartSeries>().Remove() RRS feed

  • Question

  • I presently have:
    foreach (OpenXmlElement element in plot.Elements())
      while (element.Elements<BarChartSeries>().Any())
        element.Elements<BarChartSeries>().First().Remove();
    But would prefer to do:
    foreach (OpenXmlElement element in plot.Elements())
      element.Elements<BarChartSeries>().Remove();
    

    First off, why no Remove() method? Second, is the code I do have the best way to do this?

    thanks - dave
    Windward Reports - World's Greatest SharePoint Reporting & DocGen
    Sunday, February 21, 2010 6:10 PM

Answers

  • Hi Dave!

    I think a better way to do it is:



    foreach (OpenXmlElement element in plot.Elements())
        element.RemoveAllChildren<BarChartSeries>();

    Monday, February 22, 2010 2:33 AM

All replies