HI,
I have code below but getting error "object does not match target type" on the prop.SetValue statement. But the types are both Int32.
private UniqueProjectType CreateUniqueProjectType(TBR.Domain.Project project)
{
UniqueProjectType type = new UniqueProjectType();
foreach (PropertyInfo prop in type.GetType().GetProperties())
{
if (prop.Name == "ID")
{}
else if (prop.Name == "PayFrequency")
type.PayFrequency = _tbrService.GetEmployee((int)project.EmployeeID).PayFrequency;
else
prop.SetValue(type, prop.GetValue(project, null), null);
}
return type;
}
SetValue()andGetValue()methods together with it's types otherwise we can only assume what is going on.