コード例 #1
0
ファイル: EquipableItem.cs プロジェクト: Gvin/CodeMagic
        protected override Dictionary <string, object> GetSaveDataContent()
        {
            var data = base.GetSaveDataContent();

            data.Add(SaveKeyBonuses, new DictionarySaveable(Bonuses.ToDictionary(pair => (object)(int)pair.Key, pair => (object)pair.Value)));
            data.Add(SaveKeyStatBonuses, new DictionarySaveable(StatBonuses.ToDictionary(pair => (object)(int)pair.Key, pair => (object)pair.Value)));
            data.Add(SaveKeyLightPower, (int)LightPower);
            data.Add(SaveKeyDescription, Description);
            return(data);
        }
コード例 #2
0
        private string ComposeReport()
        {
            var bonusByEmployeeId = Bonuses.ToDictionary(bonus => bonus.EmployeeId, bonus => bonus);

            var table = new ConsoleTable("Code", "Full name", "Bonus")
                        .Configure(options => options.EnableCount = false);

            foreach (var employeeId in bonusByEmployeeId.Keys)
            {
                var fullName = Employees.First(employee => employee.Id == employeeId).FullName;
                table.AddRow(employeeId, fullName, $"{bonusByEmployeeId[employeeId].Bonus:0.00}");
            }

            return(table.ToString());
        }