How to get the list of properties of a class?

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

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

10条回答
  •  醉梦人生
    2020-11-21 10:51

    You could use the System.Reflection namespace with the Type.GetProperties() mehod:

    PropertyInfo[] propertyInfos;
    propertyInfos = typeof(MyClass).GetProperties(BindingFlags.Public|BindingFlags.Static);
    

提交回复
热议问题