title: How to remove an object from a list collection?
body: <p>I had to change on my lines of code around. I before had something like this</p>
  
  <pre><code>// this is in a static method.
  List&lt;string&gt; mySTring = new List&lt;string&gt;();
  
  mySTring.add("one");
  mySTring.add("two");
  </code></pre>
  
  <p>However on one of my pages I have a dropdownlist that does not require the field "two" so instead of writing duplicate code all I did was </p>
  
  <pre><code>myString.remove("two");
  </code></pre>
  
  <p>Now I need to change my list to a <code>List&lt;SelectListItem&gt; myList = new List&lt;SelectListItem&gt;();</code></p>
  
  <p>So I have it now looking like this:</p>
  
  <pre><code>  List&lt;SelectListItem&gt; myList = new List&lt;SelectListItem&gt;()
              { 
                  new SelectListItem() { Text = "one", Value = "one"},
                  new SelectListItem() { Text = "two", Value = "two"},
              };
  </code></pre>
  
  <p>So now how do I remove the selectListItem that contains "two"? I know I probably could use remove by index. But I might add to list in the future so I don't want to start hunting down and changing it if the index changes.</p>
  
  <p>Thanks</p>