LINQ Ordering in a partition?

CSharp · Console

/Program.cs

using System;
using System.Collections.Generic;
using System.Linq;

public class Program
{
	private class Location
	{
		public Location (string name, int locationType)
		{
			Name = name;
			LocationType = locationType;
		}
		
		public string Name { get; private set; }
		public int LocationType { get; private set;}
	}
	
	public static void Main()
	{
		
		IList<Location> locations = new List<Location> 
		{
			new Location("Templestowe Lower", 2),
			new Location("Templestowe", 2),
			new Location("Melbourne", 1)
		};
		
		var results = locations.OrderBy(x => x.LocationType).ThenBy(x => x.Name);
		
		foreach(var location in results)
		{
			Console.WriteLine(location.Name);
		}
	}
}
;