title: How to write generic IEnumerable<SelectListItem> extension method
body: <p>I'm fairly new (ok, REALLy new) to generics but I love the idea of them.  I am going to be having a few drop-down lists on a view and I'd like a generic way to take a list of objects and convert it to a list of <code>SelectListItems</code></p>
  
  <p>What I have now:</p>
  
  <pre><code>public static IEnumerable&lt;SelectListItem&gt; ToSelectListItems(
       this IEnumerable&lt;SpecificObject&gt; items, long selectedId)
      {
          return
              items.OrderBy(item =&gt; item.Name)
              .Select(item =&gt;
                      new SelectListItem
                      {
                          Selected = (item.Id == selectedId),
                          Text = item.Name,
                          Value = item.Id.ToString()
                      });
      }
  </code></pre>
  
  <p>Trouble is, I'd need to repeat that code for each drop-down as the objects have different fields that represent the <code>Text</code> property of the <code>SelectListItem</code></p>
  
  <p>Here is what I'd like to accomplish:</p>
  
  <pre><code>public static IEnumerable&lt;SelectListItem&gt; ToSelectListItem&lt;T&gt;(this IEnumerable&lt;T&gt; items, string key, string value, int SelectedId) {
      // I really have no idea how to proceed from here :(
  }
  </code></pre>