I try to know if a property exist in a class, I tried this :
public static bool HasProperty(this object obj, string propertyName) { return obj.GetType().
I got this error: "Type does not contain a definition for GetProperty" when tying the accepted answer.
This is what i ended up with:
using System.Reflection; if (productModel.GetType().GetTypeInfo().GetDeclaredProperty(propertyName) != null) { }