/// <summary> /// Gets the index of the given Link into the List /// </summary> /// <param name="Link">The Link to search for</param> /// <param name="currentIndex">Current index, used to return the index</param> /// <returns>The index of the Link in the list</returns> public int IndexOf(GDDisplayLinkedListLink Link, int currentIndex) { if (this == Link) { return(currentIndex); } else if (Next != null) { if (Next == Link) // Let's skip a function call right here... { return(currentIndex + 1); } else { return(Next.IndexOf(Link, currentIndex + 1)); } } else { return(-1); } }
/// <summary> /// Returns the index at which the given GDEntity resides /// </summary> /// <param name="Entity">The GDEntity to search for</param> /// <returns>At which the given entity resides</returns> public int IndexOf(GDEntity Entity) { return(List == null ? -1 : List.IndexOf(Entity, 0)); }