C#.net利用反射,遍歷得到一個類的全部屬性名,方法名,成員名

public void PrintInstanceInfor(object t) 
{   
    //獲取全部方法 
    System.Reflection.MethodInfo[] methods = t.GetMethods(); 

    //獲取全部成員 
    System.Reflection.MemberInfo[] members = t.GetMembers(); 
    
    //獲取全部屬性 
    System.Reflection.PropertyInfo[] properties = t.GetProperties();  
}
相關文章
相關標籤/搜索