예제 #1
0
파일: Program.cs 프로젝트: sarahcsn/CDI
        static void Load(string type)
        {
            team.Clear();
            switch (type)
            {
            case "Xml": team.LoadXml(); break;

            case "Bin": team.LoadBinary(); break;

            case "Json": team.LoadJson(); break;

            case "Txt": team.LoadTxt(); break;
            }
            foreach (var item in team)
            {
                if (item.GetType() == typeof(Commercial))
                {
                    Console.WriteLine("Matricule : {0}, Nom : {1}, Prenom : {2}, Chiffre d'affaire : {3}, Commission : {4}", item.Matricule, item.Nom, item.Prenom, ((Commercial)item).ChiffreAffaire, ((Commercial)item).Commission);
                }
                else
                {
                    Console.WriteLine("Matricule : {0}, Nom : {1}, Prenom : {2}", item.Matricule, item.Nom, item.Prenom);
                }
            }
            Console.ReadLine();
        }