How do I get a list of all the properties of a class?
相关问题
- Sorting 3 numbers without branching [closed]
- Graphics.DrawImage() - Throws out of memory except
- Generic Generics in Managed C++
- Why am I getting UnauthorizedAccessException on th
- 求获取指定qq 资料的方法
I am also facing this kind of requirement.
From this discussion I got another Idea,
This is also showing the property name.
this showing number of properties.
Thanks to all. This is nice discussion.
Reflection; for an instance:
for a type:
for example:
Following feedback...
null
as the first argument toGetValue
GetProperties(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance)
(which returns all public/private instance properties ).You could use the
System.Reflection
namespace with theType.GetProperties()
mehod: