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

  • SEARCH
  • Home
  • 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 System.DateTime and System.DateTimeOffset in C#.NET? Which is best
Can someone please explain the difference between the following methods to me? it should
Can somebody explain what is the difference between getDefinitionByName and getDefinition inA AS3? When
Please, can you explain me what is the difference between HttpContext.Current.Response/Request And Page.Request/Response. Thank
Can anyone explain me difference in python shell between output variable through print and
Rails newbie here. Can anyone please explain the difference to me between the following
Possible Duplicate: Android Activity Life Cycle - difference between onPause() and OnStop() Can anybody
Possible Duplicate: Difference between single quotes and double quotes in Javascript Sorry guys, but
Can i get the source code for a WAMP stack installer somewhere? Any help
I need to solve the following question which i can't get to work by

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.