VSP
VSP

Reputation: 2393

c# Best class to hold a list of values to look up after

I have a list of values that i need to check against a constant list to know wheter they are present or not (one by one).

Im using a dictionary buy it doesnt seem logical to have the value two times (key, value)...isnt there any class specialized for this case (and faster if possible)?

Also it would me more reasonable if it could be declared as a constant being a predefined list

Upvotes: 1

Views: 706

Answers (3)

Andrey
Andrey

Reputation: 60055

HashSet

Upvotes: 2

Julien Lebosquain
Julien Lebosquain

Reputation: 41213

Use HashSet<T>.

Upvotes: 2

Carra
Carra

Reputation: 17964

Sounds like you need a HashSet.

Upvotes: 6

Related Questions