I am facing a problem about PropertyInfo
.My code is here
Type type = typeof(T);
PropertyInfo propertyInfo = type.GetProperty(filterDescriptor.Member);
if (propertyInfo != null && propertyInfo.PropertyType.FullName.ToLower() == "system.string")
{
isMemberStringType = true;
filterDescriptor.Value = filterDescriptor.Value ?? string.Empty;
}
Problem is propertyInfo
getting NULL
if filterDescriptor.Member
contains value like
abc.key
abc.Name
But when it contains Just Key and Name
,It works,it get system.string
and execute if
.How do i over come this.Help.
MSDN documentation makes it very clear:
No class can contain property with dot (.) in name.
What you are trying to achieve (I think) is to check child property (e.g. your class has property named
abc
and class of that property has its own property namedkey
).To do so, you have to use recursion.
Then you can use it like this:
Above code is not tested but should check children properties.