public static void Main()
        {
            GringottsContext gringottsContext = new GringottsContext();

            var wizards = gringottsContext.WizzardDeposits
                          .Where(w => w.DepositGroup.Equals("Troll Chest"))
                          .Select(w => w.FirstName.Substring(0, 1))
                          .Distinct();

            foreach (var wiz in wizards)
            {
                Console.WriteLine(wiz);
            }
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            GringottsContext ctx = new GringottsContext();
            var letters          = ctx.WizzardDeposits
                                   .Where(w => w.DepositGroup == "Troll Chest")
                                   .ToArray()
                                   .Select(w => w.FirstName[0])
                                   .Distinct()
                                   .OrderBy(w => w)
                                   .ToArray();

            StringBuilder sb = new StringBuilder();

            foreach (var l in letters)
            {
                sb.Append(l);
                sb.AppendLine();
            }

            File.WriteAllText("../../out.txt", sb.ToString());
        }