Listing players by score

Hello everyone. I am working on a networked game and wanted to improve my current score board system. Basically, since all my players are listed in classes, I wanted to do the follow:

foreach(Player pl in NetworkManager.Instance.PlayerList)
		{
		if(pl.Score < "other pl".Score)
			{
			pl.row = "other pl".row ++;
			Debug.Log("Switched score around");
			}
		}

Is it possible to compare different “pl” with each other? Or do I need to call back on some other solution. Thank you in advance!

Use linq?

foreach(var item in NetworkManager.Instance.Playerlist.OrderBy(x => x.Score))
{
      //Now your list is ordered by score...
}

Or more appropriately for listing by scores where highest is top, use OrderByDescending

foreach(var item in NetworkManager.Instance.Playerlist
                                  .OrderByDescending(x => x.score))
{
    //Now they're ordered highest-lowest (Descending order).
}

You’ll need to use the Linq library.

using System.Linq;