vendredi 16 septembre 2016

What is the most reliable way to compare two FieldInfo instances?

I don't mean the values.

I had a case where two instances of FieldInfo were not equalling and the cause ended up being that they were simply reflected through different types even though the declaring type on both was the same. And the name was the same.

So I came up with:

fi1.DeclaringType == fi2.DeclaringType && fi1.Name == fi2.Name

But is that the best way?





Aucun commentaire:

Enregistrer un commentaire