I have 6 XDocuments:
XDocument parametersXDoc = new XDocument(new XElement(file.Root.Element("ArrayOfParameter")));
XDocument criteriaXDoc = new XDocument(new XElement(file.Root.Element("ArrayOfCriteria")));
XDocument sortfieldsXDoc = new XDocument(new XElement(file.Root.Element("ArrayOfSortField")));
XDocument selectedfieldsXDoc = new XDocument(new XElement(file.Root.Element("ArrayOfSelectedField")));
XDocument reportlayoutXDoc = new XDocument(new XElement(file.Root.Element("ReportLayout")));
XDocument dictionaryXDoc = new XDocument(new XElement(file.Root.Element("Dictionary")));
I want to pass them all to a method as an argument. I could pass them as an array, but then I would need to know the position/index of the XDocument I require – this seems messy.
Is it possible to create a temporary wrapper object on the fly (with properties) that point to each of the XDocument variables and pass this instead?
It is possible to create a so called ‘anonymous type’, but that wouldn’t allow you to access the properties in the other method without using dynamics.
What’s so bad about just wrapping the whole lot in a class?
That class probably took less time to write than your stackoverflow question 😉