title: How to fetch conditional Deserialization xml list in c#
body: <p>I want to fetch data from deserialize xml list with some condition. But I did not get any proper solution for that. Below is my code snippet:</p>
  <pre><code> public List&lt;LinkInfo&gt; GetLinks(string entityType, string relatedEntityType, string linkType)
      {
          try
          {
              XmlSerializer deserializer = new XmlSerializer(typeof(Project));
              TextReader reader = new StreamReader(@&quot;E:\\SampleMetaData.xml&quot;);
              object obj = deserializer.Deserialize(reader);
  
              Project xmlData = (Project)obj;
              return xmlData.Module.Links.Link.Select(field =&gt; new LinkInfo
              {
                  EntityId = field.EntityId,
                  EntityType = field.EntityType,
                  RelatedEntityId = field.RelatedEntityId,
                  RelatedEntityType = field.RelatedEntityType,
                  LinkType = field.LinkType
              }).ToList();             
          }
          catch(Exception ex)
          {
              Console.WriteLine(&quot;Error in&quot;,ex);
              throw;
          }
         
      }
  </code></pre>
  <p>Below is my XML file format:</p>
  <pre><code>    &lt;Links&gt;
          &lt;Link EntityId=&quot;5&quot; EntityType=&quot;Doors_Module1&quot;  RelatedEntityId=&quot;7&quot; RelatedEntityType=&quot;Doors_Module2&quot; LinkType=&quot;InLink&quot;/&gt;
          &lt;Link EntityId=&quot;6&quot; EntityType=&quot;Doors_Module1&quot;  RelatedEntityId=&quot;8&quot; RelatedEntityType=&quot;Doors_Module2&quot; LinkType=&quot;InLink&quot;/&gt;
          &lt;Link EntityId=&quot;7&quot; EntityType=&quot;Doors_Module1&quot;  RelatedEntityId=&quot;9&quot; RelatedEntityType=&quot;Doors_Module2&quot; LinkType=&quot;External&quot;/&gt;
      &lt;/Links&gt;
  </code></pre>
  <p>I want to fetch like <strong><code>where LinkType=&quot;Inlink&quot; EntityType=&quot;Doors_Module1&quot; and RelatedEntityType=&quot;Doors_Module2&quot;</code></strong></p>
  <p>How can I do this?</p>