Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
public T ObjectAssign(T source)
Type t = this.GetType();
var properties = t.GetProperties().Where(prop => prop.CanRead && prop.CanWrite);
foreach (var prop in properties)
var value = prop.GetValue(source, null);
if (value != null)
prop.SetValue(this, value, null);
return this;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.