title: Return listBox items from function in C#
body: <p>I am trying to return the collection list of items in a list box from a function so that I can utilize the data in another function.</p>
  
  <p>I had seen a method to loop through the collection and add it to a list, but is there a better way to do this so I don't have to loop through all of the values in the list?</p>
  
  <pre><code>public list&lt;String&gt; getListItems(){
      List&lt;string&gt; selectedList = new List&lt;string&gt;();
      foreach (var item in listBox1.Items) {
         selectedList.Add(item.ToString());
      }
  }
  </code></pre>