How to get the list of properties of a class?

后端 未结 10 1328
陌清茗
陌清茗 2020-11-21 09:48

How do I get a list of all the properties of a class?

10条回答
  •  被撕碎了的回忆
    2020-11-21 10:40

    I am also facing this kind of requirement.

    From this discussion I got another Idea,

    Obj.GetType().GetProperties()[0].Name
    

    This is also showing the property name.

    Obj.GetType().GetProperties().Count();
    

    this showing number of properties.

    Thanks to all. This is nice discussion.

提交回复
热议问题