SetValue on PropertyInfo instance error “Object does not match target type” c#
Been using a Copy method with this code in it in various places in previous projects (to deal with objects that have same named properties but do not derive from a common base class or implement a common interface). New place of work, new codebase - now it's failing at the SetValue with "Object does not match target type" even on very simple examples... and it worked last week.... public static void Copy(object fromObj, object toObj) { Type fromObjectType = fromObj.GetType(); Type toObjectType = toObj.GetType(); foreach (System.Reflection.PropertyInfo fromProperty in fromObjectType