title: Linq Expression: Perform Distinct on a list dynamic property
body: <p>I've a list of objects on which I need to perform a Distinct() function. Currently I use the following code.</p>
  
  <pre><code>Return choices = displaylist
      .Select(Function(x) x.Zone)
      .ToList
      .Distinct()
  </code></pre>
  
  <p>The above code works well for me. However I need to expand this code into something that allows me to provide any property name and return me the distinct values of the list. My custom object has 20+ properties e.g. Zone, Region, Department, etc.</p>
  
  <p>I need to make a flexible function that I give any property name and it returns distinct. Something like this pseudo:</p>
  
  <pre><code>Function GetDistincts(PROPERTYNAME as string)
      Return choices = displaylist
          .Select(Function(x) x.[PROPERTYNAME])
          .ToList
          .Distinct()
  End Function
  </code></pre>
  
  <p>I believe this is job for Linq Expressions. But I'm no good at it. So need assistance here.</p>
  
  <p>Thanks!</p>