title: simulate List like hashSet in C# so that List will have noduplicate values
body: <p>I want to add colections to List, but only if Advertisements does not already exist in it. I know that HashSet works like this that has no duplicate values, but with HashSet i can not use AddRange and GetRange.</p>
  
  <p>So is it possible to simulate List like hashSet?</p>
  
  <pre><code>List&lt;Advertisements&gt; advertisements = new List&lt;Advertisements&gt;();
  
  advertisements.AddRange(NHibernateSession.CreateCriteria&lt;Advertisements&gt;()
  .CreateCriteria(AdvertisementsProperties.City.ToString())
  .Add(Restrictions.Or(
  Restrictions.Like(CitiesProperties.Name.ToString(), text, MatchMode.Anywhere),
  Restrictions.Like(CitiesProperties.SlovenianName.ToString(), text, MatchMode.Anywhere)))
  .List&lt;Advertisements&gt;());
  
  advertisements.AddRange(NHibernateSession.CreateCriteria&lt;Advertisements&gt;()
  .CreateCriteria(AdvertisementsProperties.Area.ToString())
  .Add(Restrictions.Or(
  Restrictions.Like(AreasProperties.Name.ToString(), text, MatchMode.Anywhere),
  Restrictions.Like(AreasProperties.SlovenianName.ToString(), text, MatchMode.Anywhere)))
  .List&lt;Advertisements&gt;());
  </code></pre>