C# Corner
Tech
News
Videos
Forums
Trainings
Books
Events
More
Interviews
Jobs
Live
Learn
Career
Members
Blogs
Challenges
Certifications
Bounties
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
.NET
ADO.NET
Android
ASP.NET
C#
Databases & DBA
Design Patterns & Practices
Java
Learn iOS Programming
OOP/OOD
SharePoint
Software Testing
Web Development
WPF
View All
6
Reply
In which scenario Hashset is used in C# ?
Gnanasekaran P
9y
4.4k
0
Reply
Delete Row
Delete Column
Insert Link
×
Insert
Cancel
Embed YouTube Video
×
Width (%)
Height (%)
Insert
Cancel
Table Options
×
Rows
Columns
First row as header
Create Table
Insert Image
×
Selected file:
Alignment
Left
Center
Right
Select an image from your device to upload
Upload to Server
Cancel
Submit
To get unique values from a collection holding duplicate values
Shweta Lodha
8y
0
HashSet can be used when you dont want set having duplicate values. For example - List
dupInts = new List
{1,3,4,5,3,3,6}; HashSet
noDupInts = new HashSet(dupInts); When this will run - noDupInts will have as {1,3,4,5,6}
Keerthi Venkatesan
9y
0
When a collection should have Distinct values then its suggested for Hashset
Bhuvanesh Mohankumar
9y
0
HashSet can be used when you dont want set having duplicate values. For example - List
dupInts = new List
{1,3,4,5,3,3,6}; HashSet
noDupInts = new HashSet(dupInts); When this will run - noDupInts will have as {1,3,4,5,6} Hope this helps
Kml Surani
9y
0
HashSet can be used when you dont want set having duplicate values. For example - List
dupInts = new List
{1,3,4,5,3,3,6}; HashSet
noDupInts = new HashSet(dupInts);When this will run - noDupInts will have as {1,3,4,5,6}Hope this helps
Vivek Bansod
9y
0
HashSet Is used when you want to have a collection with unique elements. HashSet stores list of unique elements and won't allow duplicates in it.
Ravi Patel
9y
0
Message