Reflection in Windows Universal Apps

前端 未结 1 711
傲寒
傲寒 2020-12-22 09:14

I need to use the GetProperties method so I can test whether any properties in a particular class has a specified custom attribute. However it doesn\'t appe

相关标签:
1条回答
  • 2020-12-22 10:05

    Add this to your using statements:

    using System.Reflection;
    

    Then you can use obj.GetType().GetRuntimeProperties() method. This method returns all properties defined on the specified type, including inherited, non-public, instance, and static properties. Keep in mind that this behavior is slightly different than the behavior of GetProperties() which is to return only the public properties.

    0 讨论(0)
提交回复
热议问题