Last active
April 7, 2021 13:39
-
-
Save bjornmicallef/0fa72b605876d8279a43c47fbe7bb75d to your computer and use it in GitHub Desktop.
This file contains 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
public static class Util | |
{ | |
public static (int, int) ParseSetupLineInPosition(string line) | |
{ | |
var t = line.Trim().Split(' '); | |
return (int.Parse(t[0]), int.Parse(t[1])); | |
} | |
public static List<(int, int)> GetMines(string line) | |
{ | |
var positions = line.Trim().Split(' '); | |
var mineList = new List<(int, int)>(); | |
foreach (string position in positions) | |
{ | |
var pos = position.Split(','); | |
mineList.Add((int.Parse(pos[0]), int.Parse(pos[1]))); | |
} | |
return mineList; | |
} | |
public static string GetEnumDescription(System.Enum enumValue) | |
{ | |
var enumMember = enumValue.GetType().GetMember(enumValue.ToString()).FirstOrDefault(); | |
var descriptionAttrbs = enumMember.GetCustomAttributes(typeof(DescriptionAttribute), true); | |
return ((DescriptionAttribute)descriptionAttrbs[0]).Description; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment