More newbie MC++ woes

I am trying to itterate over a slection of nodes and i dont have the luxury of a foreach statement in C++.
I can see
goView1->Selection->Count; //number of selections
goView1->Selection->First; //pointer to First GoObject
goView1->Selection->Last; //pointer to Last GoObject
I have hit this problem in other .net component vendors software and usualy there is a xxxxxx->Selection->Item[] type thing,
which in conjuntion with the xxxxxx->Selection->Count thing I can then itterate over the objects
Is it possible for you to suggest the correct approach GoDiagram
I appologise for having to code in MC++ but its a contractual requirement etc.

I hope i explained it correctly
All the best and thanks for all the newbie help here

Hi again I managed to use the old collection enumerator trick but... is there a better way i hate all this catching exceptions etc :¬) GoCollectionEnumerator thePain=goView1->Selection->GetEnumerator();
GoCollectionEnumerator *theChildren=&thePain;;
GoObject *item;
} All the best Mac

I suspect you don’t want to compare Types using equality.
GoObject *item = null;
try { item = __try_cast<GoObject *>(thisChildren->Current); } catch (System::InvalidCastException *) { continue; }
if (item != null) {

WARNING: although I used to be reasonably expert in C++, I haven’t done any serious programming in C++ this millenium, since long before Managed C++ and .NET existed.

Thanks walter

So the GetEnumerator is the only way to access the Selected GoObjects then…
Seeing the Selected->First and Selected->Last I was kind of hoping for a linklist style access I.E SelectedObject->Next etc

ill give your null idea that a go :¬) although you dont even get a system declared variable called null hehehe dam MC++ and its all avout to go even weirder with .net 2005 :)

I understand your position about the C++ bit
Personaly life would be 1000’s of times easier if i could use C#
But direct interaction with unmanaged C libraries stop me

Well, yes, that style access is exactly what the Enumerator provides.
GoSelection (which inherits from GoCollection, which implements IGoCollection) does not provide integer-indexed access to the collection.

Thanks sorry for all the questions but im learning :¬)