title: c# Network adapters list
body: <p>I have code, which is using <code>System.Net</code> and <code>System.Net.NetworkInformation</code> references, it generates a list of my network connection names.</p>
  
  <p>Everything seems fine and working, but when I made  a class of this code, and exported values to <code>listbox1</code> items add, I had only one network connection name, but really I have four.</p>
  
  <p>How can I solve this problem?</p>
  
  <pre><code>private void button1_Click(object sender, EventArgs e)
  {
      Adapters obj = new Adapters();
      var value = obj.net_adapters();
      listBox1.Items.Add(value);
  }
  
  public class Adapters
  {
      public string net_adapters()
      {
          string value = string.Empty;
          foreach (NetworkInterface nic in NetworkInterface.GetAllNetworkInterfaces())
          {
              value = nic.Name;
          }
          return value;
      }
  }
  </code></pre>