Wednesday, June 23, 2004

Enumerators

A little enhancement in Iterators

class DHash : Hashtable
{
public virtual object this[object key,
delegate object def(object)]
{
get
{
object r = base[key];
return r != null ? r : def(key);
}
}
}

An anonymous delegate will provide values for missing items


Comments: Post a Comment

<< Home

This page is powered by Blogger. Isn't yours?