Environment.Exit
private static void Log(string message){ Console.WriteLine($"\n{message}"); Environment.Exit(-1);}public static void Custom(string message){ Log(message);}public static void Expected(string message, int line) { Log($"[{line}] Expected '{message}'!");}
public class Test{ [Inject] public Something _Smth; [Inject] public Foo _Foo; private int Id; public Test(int id) { Id = id; }}
var test = new Test(1)
Dictionary<AIUnitType, int> availableUnits = player.Units.GroupBy(unit => unit.AIType).ToDictionary(group => group.Key, group => group.Count());foreach (AIUnitType neededUnit in _recruitSettings.Units){ if (availableUnits.ContainsKey(neededUnit) && availableUnits[neededUnit] > 0) { availableUnits[neededUnit]--; } else { AIUnitType replacementUnit = availableUnits.FirstOrDefault(pair => pair.Value > 0).Key; player.Units.First(unit => unit.AIType == replacementUnit).AIType = neededUnit; availableUnits[replacementUnit]--; }}
neededUnits
hero, hero, scout, courier
scout, courier, courier, hero