Created
April 24, 2019 14:57
-
-
Save TWolverson/c642cf011f55e1f1ef1cffb6519f741a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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