With linq i can create a query like this
XElement.Elements("...").Select(x=> useX(x));
now as x creates only a wrapper Action and useX's parameter is XElement you can use it like this aswell:
XElement.Elements("...").Select(useX);
However when i have a type that has a constructor with a matching type i.e. MyClass(XElement element) i have to use:
XElement.Elements("...").Select(x=> new MyClass(x));
My question: Is there any way to shorten the construction of an object in a way like above but with a constructor? I imagined something like this:
XElement.Elements("...").Select(MyClass);