コード例 #1
0
 public List<Skill> MapSkillModelsToSkills(List<SkillModel> skillModels)
 {
     if(skillModels == null)
     {
         return new List<Skill>();
     }
     else
     {
         var skills = new List<Skill>();
         foreach (var skillModel in skillModels)
         {
             var skill = new Skill(skillModel.Name, skillModel.Level);
             skills.Add(skill);
         }
         return skills;
     }
 }
コード例 #2
0
 private List<Skill> GenerateSkillList(Random random)
 {
     var numberOfSkills = random.Next(1, 11);
     var shuffledSkills = _skillNames.OrderBy(r => random.Next());
     var skillSubsequence = shuffledSkills.Take(numberOfSkills);
     var skillList = new List<Skill>();
     foreach (var skillName in skillSubsequence)
     {
         var skill = new Skill(skillName, random.Next(1, 11));
         skillList.Add(skill);
     }
     return skillList;
 }