I've written this handy template in C# called DictionaryValueEnum. It returns an Enumerator for a Dictionary that enumerates only the values.

The sole purpose of this enum is so I can have something reasonable when iterating through the values in a dictionary instead of:

foreach(KeyValuePair<KeyType, ValueType> kvp in myDictionary)
{
  ValueType vt = kvp.Value;
  ...
}

But of course, C#, like Java, has no free functions, so I have to encapsulate everything in a class, so my code looks like this:

foreach(ValueType vt in DictionaryValueEnum.enumerate(myDictionary))
{
  ...
}

Oh, how nice it would be to avoid all that crap and just type:

foreach(vt; myDictionary)
{
  ...
}

And I just typed about the 5 billionth time:

if(ReferenceEquals(myObj, blah))

Written in D would be:

if(myObj is blah)

I can't wait for D to take over the world, so I no longer have to write in this horrid language ;)

-Steve

Reply via email to