It depends on what you want to achieve...
Let's say you have 2 xml files. You want to join data based os some condition. Please see:
string s1 = @"<persons>
<person id='1'>
<name>Arahid</name>
</person>
<person id='2'>
<name>Belleamour</name>
</person>
</persons>";
string s2 = @"<dobs>
<dob id='1'>1977-01-01</dob>
<dob id='2'>1978-11-01</dob>
</dobs>";
XDocument xdoc1 = XDocument.Parse(s1);
XDocument xdoc2 = XDocument.Parse(s2);
var nodes = from a in xdoc1.Descendants("person")
join b in xdoc2.Descendants("dob") on (int)a.Attribute("id") equals (int)b.Attribute("id")
select new XElement ("person", new XAttribute("id", (string)a.Attribute("id")),
new XElement("name", (string)a.Element("name")),
new XElement("dob", (string)b.Value)
);
XDocument xdoc3 = new XDocument();
xdoc3.Add(new XElement("persons", nodes));
Result:
<persons>
<person id="1">
<name>Arahid</name>
<dob>1977-01-01</dob>
</person>
<person id="2">
<name>Belleamour</name>
<dob>1978-11-01</dob>
</person>
</persons>
For further information, please see:
Linq To Xml[
^]