jeudi 8 août 2019

Why does GetMember(string) return an array of MemberInfo?

I was working with reflection and came across the error System.Reflection.TargetException: Object does not match target type because I thought that Type.GetMember(string) would only return one MemberInfo, but it doesn't.

I'm curious for the reasoning why Type.GetMember(string) returns MemberInfo[]. The other reflection methods like Type.GetProperty() and Type.GetMethod() return their respective PropetyInfo and MethodInfo objects.

What is the purpose of having Type.GetMember() return an array of MemberInfo[] when the other reflection methods do not?





Aucun commentaire:

Enregistrer un commentaire