Is there a class like a Dictionary without a Value template? Is HashSet<T> the correct answer?
        Posted  
        
            by myotherme
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by myotherme
        
        
        
        Published on 2010-04-28T13:40:19Z
        Indexed on 
            2010/04/28
            13:43 UTC
        
        
        Read the original article
        Hit count: 239
        
c#
|best-practices
I have 3 tables: Foos, Bars and FooBarConfirmations
I want to have a in-memory list of FooBarConfirmations by their hash:
FooID   BarID   Hash
1       1       1_1
2       1       2_1
1       2       1_2
2       2       2_2
What would be the best Class to use to store this type of structure in-memory, so that I can quickly check to see if a combination exists like so:
list.Contains("1_2");
I can do this with Dictionary<string,anything>, but it "feels" wrong.
HashSet looks like the right tool for the job, but does it use some form of hashing algorithm in the background to do the lookups efficiently?
© Stack Overflow or respective owner