Skip to content

Instantly share code, notes, and snippets.

@TWolverson
Created April 24, 2019 14:57
Show Gist options
  • Save TWolverson/c642cf011f55e1f1ef1cffb6519f741a to your computer and use it in GitHub Desktop.
Save TWolverson/c642cf011f55e1f1ef1cffb6519f741a to your computer and use it in GitHub Desktop.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp1
{
using System;
using System.Globalization;
using System.Linq;
using System.Collections.Generic;
public class Program
{
public static void Main()
{
IEnumerable<RegionInfo> getregions()
{
RegionInfo returnThis;
for (int i = 0; i < 2000; i++)
{
try
{
returnThis = new RegionInfo(i);
}
catch
{
returnThis = null;
}
if (returnThis != null) yield return returnThis;
}
}
var regions = getregions().ToList();
var sorted = regions.GroupBy(r => r.EnglishName).OrderBy(g => g.Key);
foreach (var gr in sorted)
{
Console.WriteLine(gr.First().EnglishName + " (" + gr.Count() + ")");
}
Console.Read();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment