By Augusto Goncalves (@augustomaia)
Unlike Alignment.Entities.GetEntityByOrder, the Profile.Entities only offers a plain enumerator or .EntityAtId. But don't worry! With the FirstEntity we can iterate through the collection using a loop. The following code snippet show the idea.
By the way, the .NET Extension method will not work here due the stateless paradigm.
Profile p = // get the object here uint index = p.Entities.FirstEntity; try { while(true) { // get current entity ProfileEntity profileEntity = p.Entities.EntityAtId(index); // do something // // // get the next entity index = profileEntity.EntityAfter; // throw exception } } catch { // EntityAfter will throw an excetion, end of the loop; }