Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6036371
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T05:54:51+00:00 2026-05-23T05:54:51+00:00

Can you explain what is the difference between HashSet<T> and List<T> in .NET? Maybe

  • 0

Can you explain what is the difference between HashSet<T> and List<T> in .NET?

Maybe you can explain with an example in what cases HashSet<T> should be preferred against List<T> ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T05:54:52+00:00Added an answer on May 23, 2026 at 5:54 am

    Unlike a List<> …

    1. A HashSet is a List with no duplicate members.

    2. Because a HashSet is constrained to contain only unique entries, the internal structure is optimised for searching (compared with a list) – it is considerably faster

    3. Adding to a HashSet returns a boolean – false if addition fails due to already existing in Set

    4. Can perform mathematical set operations against a Set: Union/Intersection/IsSubsetOf etc.

    5. HashSet doesn’t implement IList only ICollection

    6. You cannot use indices with a HashSet, only enumerators.

    The main reason to use a HashSet would be if you are interested in performing Set operations.

    Given 2 sets: hashSet1 and hashSet2

     //returns a list of distinct items in both sets
     HashSet set3 = set1.Union( set2 );
    

    flies in comparison with an equivalent operation using LINQ. It’s also neater to write!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can anyone explain the difference between Server.MapPath(.) , Server.MapPath(~) , Server.MapPath(@\) and Server.MapPath(/) ?
Can anyone explain the difference between the types mentioned above and some sample usage
Can someone please explain me what's the difference between Swing and AWT? Are there
Can some one explain to me the difference between categories and inheritance in Objective
Can anyone explain difference between the ViewStack and States? Thanks, Ravi
Can anyone explain the difference between use and require , both when used directly
Can someone explain the difference between using define('SOMETHING', true); and $SOMETHING = true; And
Can someone explain the difference between these two, the first one is taken from
Can anyone explain the difference between calling GetPreamble() on a newly instantiated utf8 encoding
Can someone explain the difference between a class and a module. When do you

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.