hello, i need basic help with "Sort" comand in a list of Collider2D

hi, it’s my first time here, and a beginner in unity2d. I have a question about the syntax of my code. I have a list of enemies:

public List<Collider2D> listaEnemigos = new List<Collider2D>();

and the enemies were added to the list like this:

listaEnemigos.Add(col);

ok, now I need to sort the list according to their X position from smallest to largest, but I don’t know how to use the “Sort” command.

listaEnemigos.Sort();

It is assumed that the smallest X will be the closest to the player, and it is who I want to attack. I’m trying to do a Homming Attack like Sonic. sorry for my english, im using google translator

Something like this should put you in the right direction: