GoDocument::GetEnumerator()

I recently upgraded to GoDiagram Win 2.4.1 from 2.1.2. Under 2.1.2 I had a block of C# code that was like this:
foreach(GoObject obj in this)
{
//some stuff
}
Where “this” referenced a class derived from GoDocument. Under 2.4.1, I get an invalid cast exception. I cannot figure out how to enumerate over the objects in my document. I’ve tried getting the layers collection and enumerating over the GoObject in each layer, but I either get compile errors or invalid cast exceptions.
What is the equivalent code block in 2.4.1 to the one above?
Thanks.

Really? That should be fine. Nothing has changed. We use that internally in some of our GoDocument code. And a number of the example classes inheriting from GoDocument do it too – search the sample applications.
Could you provide that actual compilation error message?
Are you sure all references have been updated to refer to the new assemblies? Perhaps you still have an old reference to something like Northwoods.Go.Xml.dll, which might cause a problem since it would still be depending on the old Northwoods.Go.dll, and that might conflict with the new Northwoods.Go.dll.

Thanks, Walter. You nailed it! I had a reference DLL (not part of my solution) that I had overlooked in converting to 2.4.1. All is well now. Thanks for the rapid response.