So I've found myself writing code along these lines lately.
Dictionary<string, byte> dict = new Dictionary<string, byte>();
foreach(string str in arbitraryStringCollection)
{
if(!dict.ContainsKey(str))
{
ProcessString(str);
dict[str] = 0;
}
}
The example is overly generic, but the common goal I find myself shooting for is "Have I done this one already?".
I like using Dictionary for the fast key lookup, but since I never care about the value field, I can't help but feel it's slightly excessive, even if it's just a byte per entry.
Is there a better .NET tool out there that accomplishes this, something with the key lookup speed of a Dictionary but without the arbitrary and unnecessary values?