Skip to content

Commit

Permalink
Copy Data from one record to another by field name
Browse files Browse the repository at this point in the history
  • Loading branch information
jbtule committed Jan 24, 2019
1 parent cc31151 commit 043cad7
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions DotNetDBF.Enumerable/Enumerable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,15 @@ public static dynamic NewBlankRow(this DBFWriter writer)
return new Enumerable.DBFInterceptor(obj, fields);
}

public static void CopyRecordTo(this IDBFInterceptor original, IDBFInterceptor dest)
{
foreach (var fieldName in Dynamitey.Dynamic.GetMemberNames(dest, true))
{
var val = Dynamic.InvokeGet(original, fieldName);
Dynamic.InvokeSet(dest, fieldName, val);
}
}


/// <summary>
/// Writes the record.
Expand Down

0 comments on commit 043cad7

Please sign in to comment.