How to filter a sub list which is part of another list in C#
<p>I want to filter the list which is already part of another list.</p>

<p>Consider,</p>

<p>Class MainClass</p>

<pre><code>  properties

      String Name

      String MainAddress

      List&lt;SubClass&gt; ExtraInfo
</code></pre>

<p>Class SubClass</p>

<pre><code>  properties

      String Address

      String City

      String PhoneNo
</code></pre>

<p>Now i have 10 items in my List and each item in List has 2 ExtraInfo items this is List items.</p>

<p>Now i want to filter List items with Condition City == "New York".</p>

<p>So, all 10 items in the main list (List) should have the ExtraInfo (List) items based on the filter condition.</p>

<p>I mean i just want to filter the Sub list not the main list.</p>

<p>Thanks in Advance!</p>

<p>Sample Data
     Name      MainAddress       ExtraInfo
                                    Address        City        Phone No<br>
1.  Vimal      Bangalore            North Street   New York    654564646 --->Sub item 1
                                    North Street   California  464654565 --->Sub item 2</p>

<ol>
<li>Hareesh      Chennai            North Street   Washington  546466466 --->Sub item 1
                                Tower B        New York    464645465 --->Sub item 2</li>
</ol>

<p>After Filter (Condition City == "New York"), I should get the output in the main list like </p>

<pre><code> Name      MainAddress       ExtraInfo
                                Address        City        Phone No      
</code></pre>

<p>1.  Vimal      Bangalore            North Street   New York    654564646 --->Sub item 1</p>

<ol>
<li>Hareesh      Chennai            Tower B        New York    464645465 --->Sub item 1</li>
</ol>

<p>Hope this helps!</p>
