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,
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.
SMThumbnailSet ts =
new
SMThumbnailSet(
@"
D:\Temp\NoThumbs"
);
PropertyDescriptorCollection pdc = TypeDescriptor.GetProperties(ts);
PropertyDescriptor prop = pdc.Find(
"
MaxIndex"
,
false
);
Type t = prop.ComponentType;
Console.WriteLine(t.ToString());Will print:
SMUtilityClasses.SMThumbnailSet
Read the question carefully.
Understand that English isn't everyone's first language so be lenient of bad
spelling and grammar.
If a question is poorly phrased then either ask for clarification, ignore it, or
edit the question
and fix the problem. Insults are not welcome.
Don't tell someone to read the manual. Chances are they have and don't get it.
Provide an answer or move on to the next question.
Let's work to help developers, not make them feel stupid.