获取所有模块名称,或者用GetTypes来获得所有类.

获取所有模块名称,或者用GetTypes来获得所有类.


Dictionary allClass;


allClass = new Dictionary();
            System.Reflection.Assembly[] ass = AppDomain.CurrentDomain.GetAssemblies();
            int all = 0;
            for (int i = 0; i < ass.Length; i++)
            {
                Module[] ms = ass[i].GetModules();
                for (int j = 0; j < ms.Length; j++)
                {
                    Module m = ms[j];
                    if (!allClass.ContainsKey(m.Name.ToString()))
                    {
                        allClass.Add(m.Name.ToString(), 1);
                        all++;
                    }

                }
            }
            Debug.Log(ass.Length + "," + all);

你可能感兴趣的:(C#,Unity)