title: How to select Linq elements using FROM..SELECT based on conditions?
body: <p>I am reading data from XML file using from..select linq query, the data is huge. the biggest set of data I can read is 1100 lines, each line consists of 100s of characters. This causes my phone to hang and application crashes. On Emulator, it works fine,although it takes considerable amount of time to load.</p>
  
  <p>Now what I want, is based on some conditions I want include the data elements in the query. As anexample, what I have now is...</p>
  
  <pre><code> var dataSet = from r in something.Elements("chapter")
                 select new dictChapter{
                     Name = r.Attribute("Name").Value,
                     Desc1 = r.Attribute("Description1").Value,
                     Desc2 = r.Attribute("Description2").Value,
                     Desc3 = r.Attribute("Description3").Value
                 };
  ListBox.DataContext = dataSet;
  </code></pre>
  
  <p>But I want to select the Descriptions based on the settings. I want something like (I know it doesn't work, but I want explain what I want to do)</p>
  
  <pre><code> var dataSet = from r in something.Elements("chapter")
                 select new dictChapter{
                     Name = r.Attribute("Name").Value,
                     if (ShowDesc1 == true)
                         Desc1 = r.Attribute("Description1").Value,
  
                     if (ShowDesc2 == true)
                         Desc2 = r.Attribute("Description2").Value,
  
                     if (ShowDesc3 == true)
                         Desc3 = r.Attribute("Description3").Value
                 };
  ListBox.DataContext = dataSet;
  </code></pre>
  
  <ol>
  <li>How can I achieve this in C Sharp? </li>
  <li>Is there any better solution to my problem?</li>
  </ol>
  
  <p>Thanks very much</p>