#define FOR_EACH( type, var, coll ) \ if( IEnumerator *_num_ = (coll)->GetEnumerator() ) \ for ( type var; /* magic happens here */; )