title: How to find List has duplicate values in List<string>
body: <p>How to find whether the <code>List&lt;string&gt;</code> has duplicate values or not ?</p>
  
  <p>I tried with below code. Is there any best way to achieve ?</p>
  
  <pre><code>var lstNames = new List&lt;string&gt; { "A", "B", "A" };
  
  if (lstNames.Distinct().Count() != lstNames.Count())
  {
      Console.WriteLine("List contains duplicate values.");
  }
  </code></pre>