Esempio n. 1
0
    // init demographics
    void initProfession(int professionID, int Ammount)
    {
        Stopwatch stopwatch = new Stopwatch();

        stopwatch.Start();

        // Type type = getProfession(professionID);
        Profession prof = (Profession)professionID;

        for (int j = 0; j < Ammount; j++)
        {
            // try {
            //     Person temp = (Person)Activator.CreateInstance(type);
            //     Population.Add(temp);
            //     Demographics[professionID].Add(temp);
            // } catch (Exception e) {
            //     Console.WriteLine("Error: Could not initialize Person from type");
            //     Console.WriteLine(e);
            // }
            Person temp = prof.ToPerson();
            Population.Add(temp);
            Demographics[professionID].Add(temp);
        }
        // test
        Console.WriteLine(prof.ToString() + "\t" + stopwatch.Elapsed.TotalMilliseconds.ToString());
    }