public void LogTypeContent(Type type)
{
Debug.Log("-------------------propertyInfo-------------------");
PropertyInfo[] allProperties = type.GetProperties();
foreach (var propertyInfo in allProperties)
{
Debug.Log(propertyInfo.Name);
}
Debug.Log("-------------------methodInfo-------------------");
MethodInfo[] allMethods = type.GetMethods();
foreach (var methodInfo in allMethods)
{
Debug.Log(methodInfo.Name);
}
Debug.Log("-------------------fieldInfo-------------------");
FieldInfo[] allFields = type.GetFields();
foreach (var field in allFields)
{
Debug.Log(field.Name);
Debug.Log(field.FieldType);
}
Debug.Log("-------------------memberInfo-------------------");
MemberInfo[] allMeminfos = type.GetMembers();
foreach (MemberInfo memberInfo in allMeminfos)
{
Debug.Log(memberInfo.Name);
}
}
[代码段]反射输出一个Type的信息
最新推荐文章于 2024-04-04 16:30:58 发布