如何从propertydescriptor获取类名

如何从propertydescriptor获取类名

本文介绍了如何从propertydescriptor获取类名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我有属性描述符集合,但我无法获得与属性相关的类名。任何人都可以分享我如何从propertydescriptor获取类名,我必须得到该类的属性信息?



谢谢和问候,

Amal



我是什么尝试过:



为了获得propertyinfo我试过的propertyinfo.GetType()。GetProperties(BindingFlags.Public | BindingFlags.Instance)



但是我无法获得确切的信息。当我尝试使用

类型t = TypeOf(ClassName);

PropertyInfo propertyInfo = t.GetProperties(BindingFlags.Public | BindingFlags.Instance);

i获得了所需的信息,但我必须在所需的位置提供类名。我必须动态获取classname以获取上面的propertyinfo。

解决方案



Hi All,

I have property-descriptor collection , but i couldn't get the class name in which the properties are related. Could anyone share me how to get the class name from the propertydescriptor which i have to get the propertyinfo of that class?

Thanks and Regards,
Amal

What I have tried:

In order to get the propertyinfo i tried by propertyDescriptor.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance)

but i could not get the exact information. When i try using the
Type t= TypeOf(ClassName);
PropertyInfo propertyInfo= t.GetProperties(BindingFlags.Public| BindingFlags.Instance);
i got the needed information, Yet i have to give the classname in the needed place. I have to get the classname dynamically here to get the propertyinfo as above.

解决方案



这篇关于如何从propertydescriptor获取类名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 18:09