예제 #1
0
        public string DisplayAgencyRetirements(Sports sport)
        {
            List <Player> list   = new List <Player>();
            string        output = "";

            foreach (Agent a in Agents)
            {
                foreach (Player client in a.ClientList)
                {
                    if (client.Sport == sport)
                    {
                        list.Add(client);
                    }
                }
            }

            if (list.Count > 0)
            {
                output = sport.ToString() + " retirement report:";

                for (int i = 0; i < list.Count; i++)
                {
                    if (list[i].Retiring)
                    {
                        output += Environment.NewLine + "- " + list[i].Position.ToString() + " " + list[i].FullName;
                    }
                }
            }
            else
            {
                output = "No " + sport.ToString() + " retirements for the agency this year.";
            }

            return(output);
        }
예제 #2
0
        public string DisplayAgencyProgressionRegression(Sports sport)
        {
            List <Player> progressionList = new List <Player>();

            foreach (Agent a in Agents)
            {
                foreach (Player client in a.ClientList)
                {
                    if (client.Sport == sport)
                    {
                        progressionList.Add(client);
                    }
                }
            }

            string output = sport.ToString() + " progression/regression report:" + Environment.NewLine;

            for (int i = 0; i < progressionList.Count; i++)
            {
                if (progressionList[i].CurrentSkill >= progressionList[i].PreviousCurrentSkill)
                {
                    output += progressionList[i].FullName + " progressed by " + (progressionList[i].CurrentSkill - progressionList[i].PreviousCurrentSkill).ToString() + " points.";
                }
                else
                {
                    output += progressionList[i].FullName + " regressed by " + (progressionList[i].PreviousCurrentSkill - progressionList[i].CurrentSkill).ToString() + " points.";
                }
                output += Environment.NewLine;
            }

            return(output);
        }
        static void Main(string[] args)
        {
            //定义一个程序集,并加载程序集SomeSports
            Assembly assembly = Assembly.Load("SomeSports");
            //定义一个模块,并获取程序集assembly的SomeSports.dll模块
            Module module = assembly.GetModule("SomeSports.dll");

            //获取模块module的Football的类型
            Type[] types = module.FindTypes(Module.FilterTypeName, "Football");
            //输出Football类型的名称
            if (types.Length != 0)
            {
                ConstructorInfo ci      = types[0].GetConstructor(new Type[0]);
                Sports          program = (Sports)ci.Invoke(new Object[0]);
                Console.WriteLine("Sport's name is :" + program.ToString());
            }
            else
            {
                Console.WriteLine("Type not found");
            }
            //获取相关的程序集的属性值
            Module mod = Assembly.GetEntryAssembly().GetModules()[0];

            Console.WriteLine("Module Name is " + mod.Name);
            Console.WriteLine("Module FullyQualifiedName is " + mod.FullyQualifiedName);
            Console.WriteLine("Module ScopeName is " + mod.ScopeName);
        }