title: How do I get a distinct value of items in a list of object or structure?
body: <p>I have a List. This collection holds an object containing the properties of a class.
  I want a distinct value of list with respect to any specific property of a class. I have attached some sample code; please check &amp; let me know if you guys have any solutions:</p>
  
  <pre><code>class Test
  {
      public string firstname{get;set;}
      public string lastname{get;set;}
  }
  
  class Usetheaboveclass
  {
      Test objTest=new Test();
      List&lt;Test&gt; lstTest=new List&lt;Test&gt;();
  
      objTest.firstname="test";
      objTest.lastname="testing";
  
      //Now i want a distinct value with respect to lastname.if i use 
       lstTest=lstTest.Distinct().Tolist();
  
      //It will process according to all properties.    
  }
  </code></pre>
  
  <p>Can you suggest me a way to do this?</p>