SimplifyNet / Simplify

Simplify is an open-source set of lightweight .NET libraries that provide infrastructure for your applications. DI and mocking friendly.

Home Page:https://simplifynet.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Extend the XElement class with shortcut and extension methods

hardcoder opened this issue · comments

Is your feature request related to a problem? Please describe.

  1. Using system derived namespace System.Xml.XPath, we can get elements by methods XPathSelectElement and XPathSelectElements.
    It is hard to read the code with tons of that methods, for example when parsing large Xml document.
  2. We cannot use local variables that store temporary XElement objects, in expressions, for example in AutoMapper mapping expression.
    Need to define Func<XElement,XElement> to use it in expressions.

Describe the solution you'd like

  1. Add shortcut extension methods for XElement methods:
  • "Get" for XPathSelectElement
  • "GetList" for XPathSelectElements
  1. Add extension method that will return Func<XElement, XElement>.