KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have a class which has some properties of type List<float> , List<int> etc. Now I am quering the properties of this class through reflection so that I get a list of PropertyInfo . I want to filter the types which are of type List<> . But the comparison propertyInfo.PropertyType == typeof(List<>) fails. I can get around this by comparing the names, i.e., the following comparison works: propertyInfo.PropertyType.Name == typeof(List<>).Name I think there should be a better way to compare the Generic types. Any clues?
Tags (comma-separated)
Save Edits
Cancel