title: How to dynamically build xml with LINQ?
body: <p>I have arrays:</p>
  
  <pre><code>  Device[] dev = new Device[size];
    Sens[] sens = new Sens[size2];
    Channel[] chan = new Channel[size3];
    ...
  </code></pre>
  
  <p>How to dynamically build xml like this with LINQ from this arrays:</p>
  
  <pre><code>&lt;dlx vers="1.0" id="133" type="system_info"&gt;
  &lt;device software=""....&gt;
     &lt;sens name="" .../&gt;
     &lt;sens name="" ...&gt;
        &lt;chan id="".../&gt;
        &lt;chan id="".../&gt;
     &lt;sens name="" .../&gt;
  &lt;/device&gt;
  &lt;device software=""....&gt;
     &lt;sens name="" .../&gt;
        &lt;chan id="".../&gt;
        &lt;chan id="".../&gt;
        &lt;chan id="".../&gt;
        &lt;chan id="".../&gt;
        &lt;chan id="".../&gt;
     &lt;sens name="" .../&gt;
  &lt;/device&gt;
  ...
  &lt;/dlx&gt;
  </code></pre>
  
  <p>Is building XML with XElements and XAttributes and LINQ queries faster than building with  XmlWritter?</p>