simulate List like hashSet in C# so that List will have noduplicate values.
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.

So is it possible to simulate List like hashSet?

    List<Advertisements> advertisements = new List<Advertisements>();
    
    advertisements.AddRange(NHibernateSession.CreateCriteria<Advertisements>()
    .CreateCriteria(AdvertisementsProperties.City.ToString())
    .Add(Restrictions.Or(
    Restrictions.Like(CitiesProperties.Name.ToString(), text, MatchMode.Anywhere),
    Restrictions.Like(CitiesProperties.SlovenianName.ToString(), text, MatchMode.Anywhere)))
    .List<Advertisements>());
    
    advertisements.AddRange(NHibernateSession.CreateCriteria<Advertisements>()
    .CreateCriteria(AdvertisementsProperties.Area.ToString())
    .Add(Restrictions.Or(
    Restrictions.Like(AreasProperties.Name.ToString(), text, MatchMode.Anywhere),
    Restrictions.Like(AreasProperties.SlovenianName.ToString(), text, MatchMode.Anywhere)))
    .List<Advertisements>());



simulate List like hashSet in C# so that List will have noduplicate values.
===

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.

So is it possible to simulate List like hashSet?

    List<Advertisements> advertisements = new List<Advertisements>();
    
    advertisements.AddRange(NHibernateSession.CreateCriteria<Advertisements>()
    .CreateCriteria(AdvertisementsProperties.City.ToString())
    .Add(Restrictions.Or(
    Restrictions.Like(CitiesProperties.Name.ToString(), text, MatchMode.Anywhere),
    Restrictions.Like(CitiesProperties.SlovenianName.ToString(), text, MatchMode.Anywhere)))
    .List<Advertisements>());
    
    advertisements.AddRange(NHibernateSession.CreateCriteria<Advertisements>()
    .CreateCriteria(AdvertisementsProperties.Area.ToString())
    .Add(Restrictions.Or(
    Restrictions.Like(AreasProperties.Name.ToString(), text, MatchMode.Anywhere),
    Restrictions.Like(AreasProperties.SlovenianName.ToString(), text, MatchMode.Anywhere)))
    .List<Advertisements>());


