Parameter count mismatch in property.GetValue() [duplicate]

I’m pretty sure this is because your object type has an indexer “property” and you are passing null to the index parameter on the GetValue call.

Either remove the indexed property or filter out the indexed properties from your properties variable, for example:

var properties = obj.GetType().GetProperties()
                    .Where(p => p.GetIndexParameters().Length == 0);

Leave a Comment