Skip to content

Commit 6b78e8f

Browse files
Merge pull request #5 from ShawnLaMountain/main
ObjectExtentions now supports Copy of Arrays
2 parents 8be3921 + e6046d4 commit 6b78e8f

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

src/ThunderDesign.Net-PCL.ToolBox/Extentions/ObjectExtentions.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ public static bool Copy(this object self, object source, string property)
2020
targetPropertyInfo.SetValue(self, sourcePropertyInfo.GetValue(source));
2121
return true;
2222
}
23+
else if (sourcePropertyInfo.PropertyType.IsArray && sourcePropertyInfo.PropertyType.GetElementType().CanDirectlyCompare())
24+
{
25+
targetPropertyInfo.SetValue(self, ((Array)sourcePropertyInfo.GetValue(source)).Clone(), null);
26+
return true;
27+
}
28+
2329
return false;
2430
}
2531
#endif

0 commit comments

Comments
 (0)