I'm trying to select the values from two adjacent xml nodes at the same time using
var values =
xDoc.Element("root")
.Elements("model")
.Where(x => x.Element("modelName").Value == modelType.ToString())
.Elements("directory")
.Select(x => new { x.Element("directoryName").Value,
x.Element("taskName").Value });
I'm getting red squiggles under the .Values saying "Duplicate anonymous type property name 'Value'.
Here is the xml
<root>
<model>
<modelName>Model1</modelName>
<directory>
<directoryName>Dir1</directoryName>
<taskName>Task1</taskName>
</directory>
</model>
<model>
<modelName>Model2</modelName>
<directory>
<directoryName>FirstValue</directoryName>
<taskName>SecondValue</taskName>
</directory>
</model>
</root>
I want to extract Dir1 and Task1 or FirstValue and SecondValue.