public int CompareTo(NameWidget compareIcon) { if (WorldPosition.Y > compareIcon.WorldPosition.Y) { return(-1); } else if (this.WorldPosition.Y < compareIcon.WorldPosition.Y) { return(1); } else { if (this.WorldPosition.X > compareIcon.WorldPosition.X) { return(1); } else if (this.WorldPosition.X < compareIcon.WorldPosition.X) { return(-1); } else { return(-NameString.CompareTo(compareIcon.NameString)); } } }