Gnanasekaran P
In which scenario Hashset is used in C# ?
By Gnanasekaran P in .NET on Dec 29 2015
  • Shweta Lodha
    Feb, 2017 3

    To get unique values from a collection holding duplicate values

    • 0
  • Keerthi Venkatesan
    Jun, 2016 8

    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}

    • 0
  • Bhuvanesh Mohankumar
    May, 2016 30

    When a collection should have Distinct values then its suggested for Hashset

    • 0
  • Kml Surani
    Jan, 2016 9

    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

    • 0
  • Vivek Bansod
    Dec, 2015 31

    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

    • 0
  • Ravi Patel
    Dec, 2015 31

    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.

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS