I've got a Type.
How can I tell if it's an IEnumerable<>
?
These:
typeof(IEnumerable<>).IsAssignableFrom(memberType);
typeof(IEnumerable<object>).IsAssignableFrom(memberType);
return false for IEnumerable<int>
Whereas this:
typeof(IEnumerable).IsAssignableFrom(memberType);
returns true for string.
Aucun commentaire:
Enregistrer un commentaire