title: Using a Class as ValueMember in ComboBox
body: <p>I have a ComboBox, which currently uses a simple class, containing <em>Name</em> and <em>ID</em>. <em>Name</em> is used as <code>DisplayMember</code> whereas <em>ID</em> is used as <code>ValueMember</code>. However, I would actually like to pass both the <em>Name</em> and the <em>ID</em>, when selecting an item, since this would spare me the operation of looking up the name later. Of course I could store those seperately, but that seems rendundat, since they come from the same place. </p>
  
  <p>Hence arises my question: Is it possible to use the class (from which I get the Name and ID) as <code>ValueMember</code> for the <code>ComboBox</code>?</p>
  
  <p>I was thinking something like this:</p>
  
  <pre><code>cboCategory.DataSource = viewModel.categoryOptions; // Type: BindingList&lt;Equipment&gt;
  cboCategory.DisplayMember = "Name";
  cboCategory.ValueMember = ???   // &lt;--- This is where I run out of ideas
  </code></pre>
  
  <p>My Equipment class looks like this:</p>
  
  <pre><code>public class Equipment
  {
      private int id;
      private string name;
  
      public Equipment (int id, string name)
      {
          this.id = id;
          this.name = name;
      }
  
      public int Id
      {
          get { return id; }
          set { id = value; }
      }
  
      public string Name
      {
          get { return name; }
          set { name = value; }
      }
  
  }
  </code></pre>