属性
var props = typeof(RectTransform).GetProperties(); foreach (var prop in props) { Debug.Log($"{prop.Name}({prop.PropertyType.Name}): {prop.Module}, {prop.ReflectedType.Name}, defClazz:{prop.DeclaringType}, spec:{prop.IsSpecialName}, {prop.SetMethod}, meb:{prop.MemberType}"); }
成员变量
var fields = typeof(RectTransform).GetFields(); foreach (var field in fields) { Debug.Log($"{field.Name}({field.FieldType.Name}): {field.Module}, {field.ReflectedType.Name}, {field.DeclaringType}, {field.IsSpecialName}, meb:{field.MemberType}"); }
无结果
所有成员
var mebs = typeof(RectTransform).GetMembers(); foreach (var meb in mebs) { Debug.Log($"{meb.Name}: {meb.Module}, {meb.ReflectedType.Name}, {meb.DeclaringType}, meb:{meb.MemberType}"); }
标签:反射,Name,meb,prop,field,var,Log From: https://www.cnblogs.com/sailJs/p/17024541.html