title: How to find (and remove) a nested object from a List
body: <p>hope someone can help. I have an object:</p>
  
  <pre><code>public class folder
  {
      public string folderName { get; set; }
      public string folderPath { get; set; }
      public List&lt;folder&gt; subFolders { get; set; }
  }
  </code></pre>
  
  <p>as you can see the object contains an object referencing itself allowing me to build up a list of folders and sub folders, I then have a </p>
  
  <pre><code>List&lt;folder&gt; mycustomlist ect..
  </code></pre>
  
  <p>to store this in. This list can be extremely deep and works fine when binding to a treeview or custom listview.</p>
  
  <p>My problem is trying to remove a nested folder from the List, I can get the object but when using </p>
  
  <pre><code>mycustomlist.Remove(thefolder) 
  </code></pre>
  
  <p>it cant seem to locate the nested object to remove it.</p>
  
  <p>I've tried several ways using Linq but with no joy, maybe their is a better way of doing this?</p>
  
  <p>Hope someone can help,</p>
  
  <p>Thanks</p>
  
  <p>Nath</p>