简体   繁体   中英

How does ASP Classic FOR EACH loop work

I would like to now how the ASP Classic/VB6 FOR EACH loop works. I know with .NET IEnumberable/IEnumerator are involved, but how does VB6/ASP Classic do it?

Thanks!

It does it in a very similar way. A class that supports foreach has a method that has the DispID of -4 which returns an enumerator object similar to an implementation of IEnumerator.

If you intend to implement this in VB6 then whilst it is possible you will have to be prepared to jump through prohibitively complicated hoops, especially since such insanely complicated stuff is now well past its sell by date. The COM equivalent to IEnumerator is stole.IEnumVARIANT , one characteristic that makes it incompatible with a simple implementation in VB6 is that its Next method uses S_FALSE HResult.

If you really, really want to do this then get this book: Advanced Visual Basic 6 if you can. Warning from a typical VB6 developers point of view the term "Advanced" doesn't really do it justice. "Insanely deep VB6" would be a better description.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM