作用 BindFlags 是一个枚举类BindFlags作为一个特别的标志量,在反射中,通过这个标志量,可以指定搜索到的成员的类型. Type type = typeof(T); FieldInfo[] infos = type.GetFields(BindingFlags.NonPublic | BindingFlags.Instance); for (int i = 0; i < infos.Length; i++) { Debug.Log(infos[i].Name); } 注意点 public or nonpublic 必须要和instance or static 组合使用 否则不会返回任何成员我本来以为会返回公共方法成员,但是没有,只有字段成员 利用MSDN 当需要查询api的时候,这是msdn文档的地址https://docs.microsoft.com/en-us/dotnet/api/system.activator.createinstance?view=netframework-4.8#System_Activator_CreateInstance_System_Type_System_Boolean_