Sorting an Transforms array by gameobject name

I’m trying to sort a list of transform objects by the gameobject name. But it doesnt seem to work. There is no error. The skript just stops there.

var potentialWaypoints : Array = waypointContainer.GetComponentsInChildren( Transform );
	potentialWaypoints.sort(function(a : Transform,b : Transform) {
		if(a.gameobject.name < b.gameobject.name) return -1;
		if(a.gameobject.name > b.gameobject.name) return 1;
		return 0;

	});

This worked for me:

Define sorting function

function NameCompare(a : System.Object, b : System.Object) : int
        {
        return CaseInsensitiveComparer().Compare(a.name,b.name);
        }

Then use it:

potentialWaypoints.Sort(NameCompare);