I want to read graphics elements (TextElements and RectangleElements) from a GroupElement object (IGroupElement3) and put them into another in the same order as they were added to the original. The original graphics were built and added to their GroupElement in an ArcMap ScreenDisplay context, so the first graphic added has the lowest z-order, the next has the next highest, etc. My idea is to use the Elements() property of the original GroupElement to get the set of elements as an EnumElement object (IEnumElement) and then to loop through the IEnumElement, adding each element to the new GroupElement. This technique, though, will only work for me, if the elements in IEnumElement are retrieved in the same z-order as they had in the original GroupElement, i.e. lowest first to highest last (FIFO). I saw this post and got a bit worried about the idiosyncrasies of IEnumElement operations. Does anyone know if IEnumElement will maintain the original z-order of the graphics?
As context and in response to Kirk's comment below, I will say that I am doing this to get around a bug in ArcGIS for Server 10.1, where an ESRI optimized Map Service cannot handle annotation that has nested grouped graphics (see this post). Each piece of our annotation contains a GroupElement that itself contains multiple Group Elements. Each of these Sub Group Elements contains a set of Rectangle Elements and Text Elements. The workaround for the bug is to put all of the graphic elements into the containing GroupElement of the annotation without their own grouping. Because the z-order of the graphic elements within a Sub Group Element is important to maintain and because there are multiple Sub Group Elements, I want to take each Sub Group Element in turn and read its graphic elements into the annotation's GroupElement. This will avoid the bug. Otherwise, the Map Service simply won't draw the annotation.
Code is being implemented in C# in a web app. I do not have access to the server and app, so I cannot test my idea. Nonetheless, I am being asked to come up with a solution. Others will just have to test it. Thanks for any help you can offer, folks.